Hoping you guys might be able to spot what i'm missing here. I'm not able to get a simple check_uptime plugin to work in Nagios.
When I invoke help for the plugin using:
/usr/local/nagios/libexec/check_uptime -h
the result is:
usage: /usr/local/nagios/libexec/check_uptime [-c OPTION]
This script checks uptime and optionally verifies if the uptime
is below MINIMUM or above MAXIMUM uptime treshholds
OPTIONS:
-h Help
-c CRITICAL MIN uptime (minutes)
-w WARNING MIN uptime (minutes)
-C CRITICAL MAX uptime (minutes)
-W WARNING MAX uptime (minutes)
-V Version
So I tried to implement this plugin on both the nagios linux server and a linux client. I basically want the plugin to run on the remote machine named machine1 in the format
check_uptime -w 15 -c 30
The plugin executes fine on both the server and the client. The plugin also exists on both of them under /usr/local/nagios/libexec/check_uptime.
Here are my settings:
On the server:
I appended the following to /usr/local/nagios/etc/objects/commands.cfg
# 'check_uptime' command definition for linux hosts
define command{
command_name check_uptime
command_line $USER1$/check_uptime -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
}
I appended the following to /usr/local/nagios/etc/objects/hosts/machine1.cfg:
define service{
use generic-service
host_name machine1
service_description Uptime
check_command check_uptime
}
On the machine1:
I'm appending this to /usr/local/nagios/etc/nrpe.cfg:
command[check_uptime]=/usr/local/nagios/libexec/check_uptime -w 15 -c 30
Then I'm testing the configuration on the server by running:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
And I'm getting 0 warnings and 0 errors, yet in the Nagios console the service shows up as unknown.
What am I missing?
Thanks guys!
Best Answer
Nver mind. I figured it out.
Looks like I have to invoke check_nrpe in /usr/local/nagios/etc/objects/hosts/machine1.cfg as follows:
Edit: It also looks that the check_uptime command should not be invoked with the -H $HOSTADDRESS$ parameter in commands.cfg on the server end. Once that is removed, it will work on the server.
Hope this helps somebody else.