Page 1 of 2

Remote disk check not working

Posted: Wed Apr 27, 2016 3:21 pm
by jnojr
I want to get remote disk checks going. After much trial and error, I can finally use check_nrpe on the Nagios server to get values. But when I configure Nagios to watch this, I get (null)

I'm guessing this is part of having to use '-a' on the command line. I have no idea how I'm supposed to pass that along in the Nagios config, or why I'd need to... every step along the way, critical functionality (like "dont_blame_nagios") is not set up to begin with, and the only way to find out is by Googling error after error. I haven't been able to find any documentation that spells out all of the steps needed to do this... every example might tell you to do one thing, but assumes you already know all the rest.

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 3:37 pm
by lmiltchev
Example:

On the remote machine:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
Test check run from the command line on the nagios server:

Code: Select all

[root@localhost ~]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_disk -a '-w 10% -c 5% -p /'
DISK OK - free space: / 2821 MB (29% inode=69%);| /=6692MB;8650;9131;0;9612
Hope this helps.

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:01 pm
by jnojr
lmiltchev wrote:Example:

On the remote machine:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
Then why is the default in nrpe.cfg:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
???

In any case, that didn't help, the service status is complaining about "check_disk: Could not parse arguments" and gives usage.
Test check run from the command line on the nagios server:

Code: Select all

[root@localhost ~]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_disk -a '-w 10% -c 5% -p /'
DISK OK - free space: / 2821 MB (29% inode=69%);| /=6692MB;8650;9131;0;9612
That part works perfectly. But there's that '-a'... and I do not see a '-a' in any config or in any example of any config.

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:05 pm
by jnojr
With debugging turned up to 2048, I can see that nagios builds the command to:

Code: Select all

/usr/lib64/nagios/plugins/check_nrpe -H 192.168.2.20 -c check_disk
It doesn't add the -w, -c, or -p parts. In my service definition, I have:

Code: Select all

check_nrpe!check_disk!20%!10%!/

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:24 pm
by ssax
Please post your command definition for check_nrpe in your /usr/local/nagios/etc/commands.cfg.

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:31 pm
by jnojr
ssax wrote:Please post your command definition for check_nrpe in your /usr/local/nagios/etc/commands.cfg.

Code: Select all

define command{
     command_name      check_nrpe
     command_line      $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
     }

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:35 pm
by ssax
With the way your check is defined, you should have this:

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$ $ARG3$

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:38 pm
by ssax
Wait.. sorry.. use this:

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a '-w $ARG2$ -c $ARG3$ -p $ARG4$'
And then you would use this in the nrpe.cfg:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:46 pm
by jnojr
ssax wrote:Wait.. sorry.. use this:

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a '-w $ARG2$ -c $ARG3$ -p $ARG4$'
And then you would use this in the nrpe.cfg:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
There we go!

So, clearly, this shouldn't be 'check_nrpe', but 'check_nrpe_disks' or something.

Re: Remote disk check not working

Posted: Wed Apr 27, 2016 4:47 pm
by rkennedy
Nice! Did that get it working for you on your system? Just trying to figure out if we can mark this as resolved.