Remote disk check not working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
jnojr
Posts: 13
Joined: Wed Apr 27, 2016 3:15 pm

Remote disk check not working

Post 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.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Remote disk check not working

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jnojr
Posts: 13
Joined: Wed Apr 27, 2016 3:15 pm

Re: Remote disk check not working

Post 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.
jnojr
Posts: 13
Joined: Wed Apr 27, 2016 3:15 pm

Re: Remote disk check not working

Post 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%!/
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Remote disk check not working

Post by ssax »

Please post your command definition for check_nrpe in your /usr/local/nagios/etc/commands.cfg.
jnojr
Posts: 13
Joined: Wed Apr 27, 2016 3:15 pm

Re: Remote disk check not working

Post 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$
     }
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Remote disk check not working

Post 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$
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Remote disk check not working

Post 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$
jnojr
Posts: 13
Joined: Wed Apr 27, 2016 3:15 pm

Re: Remote disk check not working

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Remote disk check not working

Post 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.
Former Nagios Employee
Locked