Nrpe - check_disk and passive check [solved]

Hi all,
I read the documentation but I am obviously missing something. I am trying to use nagios to monitor the free space on remote disks.

I thought “check_disk” was what I had to use but the scripts mention a “-H” (host) which is not part of the command.

Could someone point me to the apropriate documentation or give me a hands on example?

I am running Nagios 2.0 rc2 on a Gentoo box.

Here is what I have:

=On the server=

–/etc/nagios/bigger.cfg–
define service{
host_name gentest
service_description /
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 1
retry_check_interval 1
contact_groups linux-admins
notification_interval 2440
notification_period 24x7
notification_options w,u,c,r
check_command check_disk!20%!10%!/
}

–/etc/nagios/checkcommands.cfg–
define command{
command_name check_disk
command_line /usr/nagios/libexec/check_disk -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $ARG3$
}

** note the -H which is obviously not right but which I took from a “working” example **

=On the host=

–/etc/nagios/nrpe.cfg–
command[check_disk]=/usr/nagios/libexec/check_disk -w 20% -c 10% -p /

=Browser=
The error I get in the browser is:

check_disk: Unknown argument - (null)

Any help would greatly be apreciated :wink:
Ed.
Edited ]

try to check_nrpe plugin. And remember that you have to have thous plugins installed on that nrpe host allso.

try on commandline /usr/nagios/libexec/check_nrpe -h that should get you started.

Hi klamppa,
I tried all that or I’d be blushing for not RTFM :wink:

I tried to do it manually with check_ups which seems to have a “host flag” but still no go… can anyone figure this out… I’m at a loss.

Here is another hands on exampe of what I get for my UPS.

on the host:

gentest libexec # ./check_ups -u mge
UPS OK - Status=Online, Charging Utility=235.2V Batt=67.0% Load=51.0% |voltage=235200mV;;;0 battery=67%;;;0;100 load=51%;;;0;100

gentest libexec # ./check_ups -u mge -H localhost
UPS OK - Status=Online, Charging Utility=234.3V Batt=67.0% Load=51.0% |voltage=234300mV;;;0 battery=67%;;;0;100 load=51%;;;0;100

gentest libexec # ./check_ups -u mge -H 10.0.0.175
Error: unable to parse variable
Invalid response received from host

On the server:

wstux libexec # ./check_ups -H gentest -u mge
Error: unable to parse variable
Invalid response received from host

wstux libexec # ./check_ups -H 10.0.0.175 -u mge
Error: unable to parse variable
Invalid response received from host

Thanks for any help :slight_smile:

Hmmmm… did I miss nsca?
I’ll get back to you on that… hope that’s not the problem… blush :wink:

Nop, I’m just confused.

Could someone tell me what I need on both server and client for me to be able to check the disks or ups of the client?

Should the server make the request or should the client initiate the request.

Please help… too long in config files and manuals can get confusing…
thanks

If you want your nagios server to perform passive checks, use nsca.
If you want your nagios server to perform active checks, use nrpe.
So, which do you want?
With passive checks, the actual check is performed by the remote host, and the results is sent to nagios server as a passive check.
With an active check, the nagios server spends the time to make the check actively by connecting to the remote host, making the check, and then handling the resutls.

To use either one, the README file included spells it out pretty well, on just how to use them.

That clear up to a point… If I may use disk_check as an example.

As disk_check can not specify a host, does that mean I will have to use nsca rather than nrpe?

I’m reading the READMEs again but I think I was just missing the clear one liner you wrote.
thanks
Ed.
Back to RTFM

No, you don’t have to use nsca if you don’t want to.

The plugin, check_disk, is a local check, so no -H option.
If you want, you can run the check locally on the remote host, then pass the output of that check via nsca. See the nsca docs for more info.

Or if you prefer and active check, then run the check_disk via nrpe.
According to the nrpe readme, on the nagios server:
define service{
host_name someremotehost
service_description someremoteservice
check_command check_nrpe!yourcommand
… etc …
}where “yourcommand” is a name of a command that you define in
your nrpe.cfg file on the remote host.
on the remote host, define the “yourcommand” in nrpe.cfg
command[check_disk1]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1

You must make a decision, passive or active. If you plan to have a large number of checks, then make most of them passive.

I’m getting there but now I get the following from the client:

Jan 30 15:52:06 gentest nrpe[8440]: Connection from 10.0.0.11 port 1552
Jan 30 15:52:06 gentest nrpe[8440]: Host address checks out ok
Jan 30 15:52:06 gentest nrpe[8440]: Handling the connection…
Jan 30 15:52:06 gentest nrpe[8440]: Error: Request contained command arguments, but argument option is not enabled!
Jan 30 15:52:06 gentest nrpe[8440]: Client request was invalid, bailing out…
Jan 30 15:52:06 gentest nrpe[8440]: Connection from 10.0.0.11 closed.

This is what I have on the server:

define service{
host_name gentest
service_description disk
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 1
retry_check_interval 1
contact_groups linux-admins
notification_interval 2440
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_boot!20%!10%!/boot
}

define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$
}

On the client:

command[check_boot]=/usr/nagios/libexec/check_disk -w 20% -c 10% -p /boot

I’m happy to read more doc but I find the README a tad limited for a newbie.

Anyone have a working example to help me understand?
Thanks again
Ed.

perhaps you should look at ./check_nrpe --help. I don’t see that you can pass a -a to nrpe.
On your nagios server you define your check as:
check_command check_nrpe!yourcommand
just like the README says to do.
On the remote host you define “yourcommand” in the nrpe.cfg like:
command[yourcommand]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1

So, the remote host executes the command “yourcommand” which contains all the switches/options/etc…

Your problem is exactly what the error says: “…argument option is not enabled!

You cannot define arguments for NRPE on your Nagios configuration unless you compile NRPE specifically to allow arguments. The way around this is to just define the arguments on the NRPE host, which I see you have done.

Your fix should be to get rid of the !20%!10%!/boot arguments in your service definition. Then make sure to restart NRPE (restarting Nagios will not be necessary).

Looks like you’ve got everything else configured correctly, though, as you’re clearly able to make a connection to the correct port on the remote host.

Edited Sun Jan 29 2006, 10:40PM ]

Yup, that did it! :slight_smile:

Here is what I have… it might help another newbie soul passing through here. Thank you all for your fab help and patience!

define service{
host_name gentest
service_description /boot
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 1
retry_check_interval 1
contact_groups linux-admins
notification_interval 2440
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_boot
}

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

command[check_boot]=/usr/nagios/libexec/check_disk -w 20% -c 10% -p /boot

then restart mrpe

Voila.

On nagios server:
check_command check_nrpe!check_boot

On remote host:
command[check_boot]=/usr/nagios/libexec/check_disk -w 20% -c 10% -p /boot

Glad you got it figured out. Now, to reitterate, the README file had shown this, but it can be a bit confusing. So, it’s important to not deviate from the README until you know exactly what’s going on.

No problem, and yes, the README can be a bit confusing, though that info is in there…

This is a bit of an off-hand question, but…and reason why you’ve got your notification interval set to 2440? If you’ve got interval length set to default, then that’s over 40 hours between notifications…

Hmmm… never was much good at maths :wink:

I meant 720.

Thanks again for all your help… it’s tough being new to nagios but I am learning fast :slight_smile:

Time to check my software raid now!
Ed.