Page 1 of 1
Nagios 3.5.1 - check_uptime plugin
Posted: Mon Jun 22, 2015 9:53 pm
by Mcw33
Having a bit of trouble with this plugin check_uptime
http://nagios-plugins.org/doc/man/check_uptime.html
I'm able to run the command manually from the nagios server and return a value
useraccount@nagios:/usr/local/nagios/etc/objects/company$
/usr/local/nagios/libexec/check_nrpe -H 192.168.2.117 -c check_uptime
OK: uptime: 4d 02:31h, boot: 2015-Jun-19 00:07:50 (UTC)|'uptime'=354702s;172800;86400
But when trying to add this into a host.cfg file I'm getting a (No output returned from plugin).
I can also see when manually running the above command I can see from the nscp log
"nrpe Accepting connection from: 192.168.11.222, count=1" on the windows host which then gives me the above result a second after, but when trying to force a recheck from nagios web interface this doesn't occur on the command window.
host.cfg
define service{
use generic-service
host_name Test_Machine1
service_description check_uptime
check_command check_nrpe!check_uptime -H 192.168.2.117 days 3 5
}
command.cfg
# 'check_uptime' command definition for linux hosts
define command{
command_name check_uptime
command_line $USER1$/check_uptime -o $ARG1$ -w $ARG2$ -c $ARG3$
}
What I ultimately want is
check_uptime -o days -w 70 -c 90
Any Idea's?
Re: Nagios 3.5.1 - check_uptime plugin
Posted: Tue Jun 23, 2015 9:12 am
by jdalrymple
Mcw33 wrote:host.cfg
define service{
use generic-service
host_name Test_Machine1
service_description check_uptime
check_command check_nrpe!check_uptime -H 192.168.2.117 days 3 5
}
command.cfg
# 'check_uptime' command definition for linux hosts
define command{
command_name check_uptime
command_line $USER1$/check_uptime -o $ARG1$ -w $ARG2$ -c $ARG3$
}
In the above service definition you're running the command check_nrpe, not check_uptime. While this is proper, we cannot troubleshoot without seeing your check_nrpe command definition. Based upon what you have though, it should look something like this:
Code: Select all
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define service {
.....
check_commnad check_nrpe!check_uptime
.....
}
If you have arguments enabled you can pass your thresholds as such:
Code: Select all
define service {
.....
check_commnad check_nrpe!check_uptime -u days -w 70 -c 90
.....
}
Otherwise you'll have to handle it in nrpe.cfg.
Re: Nagios 3.5.1 - check_uptime plugin
Posted: Tue Jun 23, 2015 3:28 pm
by Mcw33
Hi, Thanks for the reply.
This is the only "nrpe.cfg file I can find "check_nrpe.cfg" what modifications wouldn I need to make here? Located in /etc/nagios-plugins/config
# this command runs a program $ARG1$ with arguments $ARG2$
define command {
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}
# this command runs a program $ARG1$ with no arguments
define command {
command_name check_nrpe_1arg
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
Re: Nagios 3.5.1 - check_uptime plugin
Posted: Tue Jun 23, 2015 3:53 pm
by abrist
Well, you will need to edit the nrpe.cfg file on the remote nrpe host, add the command there, and then call it through check_nrpe from the nagios server. The following steps assume that nrpe and the nagios-plugins package are installed on the remote host with defualt ./configure options.
On the remote host, edit:
Add:
Code: Select all
command[check_uptime]=/usr/local/nagios/libexec/check_uptime $ARG1$
Also, verify that nrpe is configured to support arguments:
Save out and restart nrpe:
Or:
Now, we need to check the command and service check definitions on the nagios box:
Code: Select all
host.cfg
define service{
use generic-service
host_name Test_Machine1
service_description check_uptime
check_command check_uptime!-u days -w 70 -c 90
}
command.cfg
# 'check_uptime' command definition for linux hosts
define command{
command_name check_uptime
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_uptime -a $ARG1$
}
Does this make sense?
Re: Nagios 3.5.1 - check_uptime plugin
Posted: Sun Jun 28, 2015 4:38 pm
by Mcw33
Hi sorry been a bit busy with other work things.
It's made sense and I've made the changes advised, one thing I have found is there is no nrpe.cfg file on the remote host, I wasn't the one to setup this nagios box so I don't know why.
I've tried a quick google to see what I need to do to setup this but haven't come across whats needed. I've created the file in /usr/local/nagios/etc/nrpe.cfg and listed the following
Code: Select all
command[check_uptime]=/usr/local/nagios/libexec/check_uptime $ARG1$
dont_blame_nrpe=1
edit: Sorry installed the nagios-nrpe-server plugin and added the above details. Still showing as no "(No output returned from plugin)" and I can't see the nsclient.log file receiving the command. I have been able to return a output from the nagios server to this host so I know there isn't any FW/Network issues in between them
Re: Nagios 3.5.1 - check_uptime plugin
Posted: Sun Jun 28, 2015 7:43 pm
by Box293
Lets see if we can find the nrpe.cfg file as the one you create may not be reference.
Does this file exist: /etc/xinetd.d/nrpe
If so, it will reference the nrpe.cfg file
Re: Nagios 3.5.1 - check_uptime plugin
Posted: Mon Jun 29, 2015 9:55 pm
by Mcw33
Hi, I get the following
Code: Select all
User@nagios:~$ sudo find / -name 'nrpe.cfg'
[sudo] password for user:
/etc/nagios/nrpe.cfg
/usr/local/nagios/etc/nrpe.cfg
Re: Nagios 3.5.1 - check_uptime plugin
Posted: Mon Jun 29, 2015 10:31 pm
by Box293
I believe this file:
/etc/nagios/nrpe.cfg
is what you need to define the following in:
Code: Select all
command[check_uptime]=/usr/local/nagios/libexec/check_uptime $ARG1$
dont_blame_nrpe=1