Nagios 3.5.1 - check_uptime plugin
Nagios 3.5.1 - check_uptime plugin
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?
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?
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Nagios 3.5.1 - check_uptime plugin
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: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$
}
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
.....
}Code: Select all
define service {
.....
check_commnad check_nrpe!check_uptime -u days -w 70 -c 90
.....
}Re: Nagios 3.5.1 - check_uptime plugin
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$
}
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
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:
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:
Does this make sense?
On the remote host, edit:
Code: Select all
/usr/local/nagios/etc/nrpe.cfgCode: Select all
command[check_uptime]=/usr/local/nagios/libexec/check_uptime $ARG1$ Code: Select all
dont_blame_nrpe=1Code: Select all
service xinetd restartCode: Select all
service nrpe restartCode: 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$
}Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Nagios 3.5.1 - check_uptime plugin
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
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
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- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Nagios 3.5.1 - check_uptime plugin
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
Code: Select all
find / -name 'nrpe.cfg'If so, it will reference the nrpe.cfg file
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios 3.5.1 - check_uptime plugin
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
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Nagios 3.5.1 - check_uptime plugin
I believe this file:
/etc/nagios/nrpe.cfg
is what you need to define the following in:
/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=1As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.