Page 1 of 1

need help to monitor remote server

Posted: Tue Feb 17, 2015 6:54 pm
by ducle99
I try to monitor remote host, so I add remote host as indicated in the attached file, but it only works for current load and current users, and it fails for other services. Thanks very much for your help.

Re: need help to monitor remote server

Posted: Tue Feb 17, 2015 7:04 pm
by Box293
So for check_users, here is why it works:

ddctst101.cfg

Code: Select all

check_command			check_nrpe!check_users
nrpe.client.cfg

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
Nagios looks at ddctst101.cfg and uses the argument "check_users" which it sends over to the client.

The client is listening and looks in it's config. It sees a command called "check_users" so it executes it and returns the result.

Now if you look at one that doesn't work:

ddctst101.cfg

Code: Select all

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       ddctst101
        service_description             Total Processes
	check_command			check_nrpe!check_procs
        }
nrpe.client.cfg

Code: Select all

command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
The reason why this doesn't work is because nagios uses the argument "check_procs" which it sends over to the client.

The client is listening and looks in it's config. It doesn't have a command called "check_procs" so it fails.

However there is a command defined called "check_total_procs" and if you changed ddctst101.cfg to use "check_total_procs" instead of "check_procs", it would work.

Does that make sense?

Re: need help to monitor remote server

Posted: Wed Feb 18, 2015 5:19 pm
by ducle99
Thanks for your help. It works. However, I have another issue with check swap.
Here is content in nrpe.client.cfg
.....
command[check_swap]=/usr/local/nagios/libexec/check_swap -H localhost -w 20 -c 10
...
On Nagios master dashboard, on the line Swap usage under status information: Missing Host or Password arguments.
Could you please help for this issue? I really appreciate for your help.

Re: need help to monitor remote server

Posted: Wed Feb 18, 2015 5:37 pm
by tmcdonald
Can you post the service config for the service that runs check_nrpe for the swap usage? You likely are missing a -H in the check_nrpe args or you do not have a password defined.

Re: need help to monitor remote server

Posted: Wed Feb 18, 2015 5:53 pm
by ducle99
FIles attached.

Re: need help to monitor remote server

Posted: Wed Feb 18, 2015 6:01 pm
by Box293
ducle99 wrote:command[check_swap]=/usr/local/nagios/libexec/check_swap -H localhost -w 20 -c 10
The plugin check_swap does not use the -H argument. Change it to:

Code: Select all

command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20 -c 10
It's always best to test the command on the remote device first, it'll weed out these little problems.

Re: need help to monitor remote server

Posted: Wed Feb 18, 2015 6:22 pm
by ducle99
Yes, I have tried check_swap without -H option, but I still get the same error.

Re: need help to monitor remote server

Posted: Wed Feb 18, 2015 7:42 pm
by Box293
On the remote host, show us the output of:

Code: Select all

su nagios
/usr/local/nagios/libexec/check_swap -w 20 -c 10
I get:
SWAP OK - 100% free (1983 MB out of 1983 MB) |swap=1983MB;0;0;0;1983

Re: need help to monitor remote server

Posted: Mon Feb 23, 2015 1:40 pm
by ducle99
/usr/local/nagios/libexec/check_swap -w 20 -c 10
Missing Host or Password arguments

/usr/local/nagios/libexec/check_swap version 1.9.2 last updated 03.17.2011

* OVERVIEW *
This utility was written 10/25/2004 as a method for automating
the collection of SNMP based information, for the ultimate goal
of pushing the result to Nagios.

* USAGE *

/usr/local/nagios/libexec/check_swap ARGS

ARGS:
-v Print version and exit
-h Print this help message
-d n Turn debug on at level n (1-3)
-H SNMP (remote) host to poll
-w n Warning level (alert if free swap (MB) drops below this)
n% Warning level (alert if % of swap free drops below this)
-c n Critical level
n% Critical level
-p SNMP Community password on remote host


All options can be prefixed with a single or double "-".
All options are case sensitive and only eval the first character
(e.g. --debug is the same as --d, -d, -debug)

Re: need help to monitor remote server

Posted: Mon Feb 23, 2015 4:46 pm
by jdalrymple
This must be a 3rd party check_swap plugin. Can you try the check_swap plugin from the official nagios plugins?

http://www.nagios.org/download/plugins