Page 1 of 2

General config issues for Nagios3 Rashberry PI

Posted: Thu May 07, 2015 5:05 am
by nathanplatt
I've very new to linux/raspberry pi os and am trying to configure Nagios to monitor some of our servers as a proof of concept. At the moment I have been able to install nsclient ++ on the servers but I'm only getting errors examples are;

C:\ Drive Space

This service has 1 comment associated with it This service is flapping between states
WARNING 2015-05-07 10:00:46 0d 0h 5m 43s 4/4 could not fetch information from server

Memory Usage

This service has 1 comment associated with it This service is flapping between states
CRITICAL 2015-05-07 09:58:09 0d 0h 3m 20s 4/4 (Return code of 139 is out of bounds)

Port 1 Bandwidth Usage

UNKNOWN 2015-05-07 09:59:40 22d 20h 52m 52s 4/4 check_mrtgtraf: Unable to open MRTG log file

Port 1 Link Status

UNKNOWN 2015-05-07 10:00:46 22d 20h 51m 58s 4/4 External command error: MIB search path: //.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp

Could someone help me identify the issue?

Nathan

Re: General config issues for Nagios3 Rashberry PI

Posted: Thu May 07, 2015 9:17 am
by tmcdonald
Is the IP address of the Pi listed in the nsclient configuration under "allowed_hosts"? If so, did you restart the agent after adding it?

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 8:38 am
by nathanplatt
I never specified an allowed host, i've gone back to try and simplify this, i'm just working on get check NSClient++ Version to work. its currently saying that check_nt: Could not parse arguments.

# 'check_nt' command definition
define command{
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

Am i missing something?

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 10:06 am
by jolson
Well, there are a few things at play here, and we need to understand how they all work together.

First, there's your command definition:

Code: Select all

# 'check_nt' command definition
define command{
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}
We can look at the help menu of check_nt with the following command to understand if the above definition is okay:

Code: Select all

/usr/local/nagios/libexec/check_nt -h
check_nt v2.0.3 (nagios-plugins 2.0.3)
Copyright (c) 2000 Yves Rubin ([email protected])
Copyright (c) 2000-2014 Nagios Plugin Development Team
        <[email protected]>

This plugin collects data from the NSClient service running on a
Windows NT/2000/XP/2003 server.


Usage:
check_nt -H host -v variable [-p port] [-w warning] [-c critical]
[-l params] [-d SHOWALL] [-u] [-t timeout]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
Options:
 -H, --hostname=HOST
   Name of the host to check
 -p, --port=INTEGER
   Optional port number (default: 1248)
 -s, --secret=<password>
   Password needed for the request
 -w, --warning=INTEGER
   Threshold which will result in a warning status
 -c, --critical=INTEGER
   Threshold which will result in a critical status
 -t, --timeout=INTEGER
   Seconds before connection attempt times out (default:  -l, --params=<parameters>
   Parameters passed to specified check (see below) -d, --display={SHOWALL}
   Display options (currently only SHOWALL works) -u, --unknown-timeout
   Return UNKNOWN on timeouts10)
 -h, --help
   Print this help screen
 -V, --version
   Print version information
 -v, --variable=STRING
   Variable to check
This definition looks good, as it specifies a port, and leaves one macro open for 'v' and one open for whatever you might need to specify (a timeout or similar).

Next, we'll want to check on your service definitions - specifically the services that you're having trouble with. According to your main post, they probably look something like:

Code: Select all

check_command check_nt!CheckDisk
or similar. Note that this service will take the 'check_nt' command (command_name check_nt) and run the 'CheckDisk' argument in the place of $ARG1$.

Make sure the above looks proper - that your service definitions have proper arguments in relation to your command definition.


Next, we'll want to check the NSClient side to ensure that everything is setup properly there. Please post your NSClient.ini file - it should be in the Program Files\NSClient directory on your Windows machines.
2015-05-08 10_05_36-C__Program Files_NSClient++.png
Let us know - thanks!

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 10:40 am
by nathanplatt
Here's the nsclient for one of the TS servers I'm using as test, here's the current commands and setups;

commands.cfg

# 'check_nt' command definition
define command{
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

nagios.cfg

# Commands definitions
cfg_file=/etc/nagios3/commands.cfg

# Debian also defaults to using the check commands defined by the debian
# nagios-plugins package
cfg_dir=/usr/lib/nagios/plugins/

# Debian uses by default a configuration directory where nagios3-common,
# other packages and the local admin can dump or link configuration
# files into.
cfg_dir=/etc/nagios3/conf.d

Did you need anything else?

Nathan

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 10:56 am
by jolson
Try adding the following arguments to nsclient.ini and restarting the NSClient++ service:

Code: Select all

[/settings/default]
allowed hosts = NETADDR/NETMASK
password = nsclient

[/modules]
NSClientServer = 1
CheckSystem = 1
CheckDisk = 1
NRPEServer = 1

[/settings/NRPE/server]
use ssl = 1
payload length = 1024
allow nasty characters = false
allowed ciphers = ADH
ssl = 1
allow arguments = 1
insecure = 1
Change 'allowed hosts' and 'password' to your liking. Note that you may need to add '-s nsclient' to your check_nt command configuration, as NSClient will now require a password to be contacted properly.

Do checks from your Nagios box work after the above changes?

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 11:12 am
by nathanplatt
I tried what you said and this is what happened


C:\Program Files>cd nsclient++

C:\Program Files\NSClient++>nscp settings --generate ini --add-defaults --load-a
ll
E core Failed to register plugin check_nrpe: Could not load NSLoadModuleEx

D:\source\nscp\service\NSClient++.cpp:214
E core Failed to register plugin LUAScript: Could not load library: 126: T
he specified module could not be found.
: LUAScript.dll
D:\source\nscp\service\NSClient++.cpp:214

C:\Program Files\NSClient++>

I tried openning CMD as Administrator and tried again, same errors.

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 11:16 am
by jolson
Nathan,

Please try using the configuration that I posted above - it should get you set up for both check_nrpe and check_nt depending on what you'd like to use to perform checks against your Windows machines.

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 4:27 pm
by nathanplatt
Thanks very much for the help,

I've updated it and at the moment I'm getting;


TS10-V NSClient++ Version OK 2015-05-08 21:24:19 0d 0h 0m 44s 1/4 (No output returned from plugin)

I'll leave this to monitor overnight and see what else happens, should I be able to add in other checks like CPU load with that set-up? Can i copy that ini to other servers or does it need customising for other devices?

Thanks in advance

Nathan

Re: General config issues for Nagios3 Rashberry PI

Posted: Fri May 08, 2015 10:32 pm
by nathanplatt
Just checked and its still doing this;


TS10-V NSClient++ Version This service has 1 comment associated with it This service is flapping between states

WARNING 2015-05-09 03:29:19 0d 0h 15m 3s 4/4 could not fetch information from server

Any further ideas?