Hi All,
Thanks for taking the time to read this. I am currently trying to setup Nagios to monitor a Feed Handler on a remote Linux box. I am so close I can taste it! Sadly, the nagios admin doesn't appear to be reading the command properly. I am new to Nagios so please bear with me, there are a lot of moving pieces so I thought i would provide as much information as possible to make it easy to figure out the issue. If there is something I am missing, please don't hesitate to ask.
To start with, the admin is successfully monitoring other services on the box, ping, processes, disk usage, etc. but for the custom plugin I am trying to read, it fails with a status of CRITICAL and status info of NULL. Here is what I believe to be the relevant config info.
On the machine being monitored
I added the perl script I created to /usr/local/nagios/libexec/custom/ (its a modification of http://www.deimos.fr/gitweb/?p=nagios_p ... 45;hb=HEAD I have tested it from the command line and it works as expected)
in the file: vi /usr/local/nagios/etc/nrpe.cfg i added
command[check_wadmin]=perl /usr/local/nagios/libexec/custom/check_wadmin.pl -f /tmp/nagiosInput.txt -i wait -n 35
On the monitoring machine
I already had the machine monitoring the remote linux box's basic stats, I did this by creating a remotelinuxhost.cfg file at /usr/local/nagios/etc/objects (and adding a reference in the main config)
To remotelinuxhost.cfg I added:
define service{
use generic-service ; Name of service template to use
host_name Sun89
service_description Check Feed Handler
check_command check_wadmin
}
I also added commands.cfg (in the same folder)
define command{
command_name check_wadmin
command_line perl /usr/local/nagios/libexec/custom/check_wadmin.pl -f /tmp/nagiosInput.txt -i wait -n 35
}
When I reloaded the service, it accepted the config but the result is as listed above... if anyone has any suggestions it would be greatly appreciated!!!
Problem with custom plugin on a remote linux box
-
puckoff7337
- Posts: 3
- Joined: Thu Sep 02, 2010 1:36 am
-
tonyyarusso
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Problem with custom plugin on a remote linux box
Can you run the plugin successfully from the command line as the nagios user? If yes, then I suspect you need to add a line to your perl script to include /usr/local/nagios/libexec in the perl path.
-
puckoff7337
- Posts: 3
- Joined: Thu Sep 02, 2010 1:36 am
Re: Problem with custom plugin on a remote linux box
Hi Tony, Thanks for the response, sorry for my delayed reply!
To answer your question, I can run the plugin successfully from the command line as the nagios user (the box being monitored that is)
I am not sure what your second suggestion was, can you please elaborate?
Just an FYI, I also posted this question to the mailing list and they suggested I try adding the full path to the perl interpreter so I have tried the following now as well
On the machine being monitored
I have the perl script I created in /usr/local/nagios/libexec/custom/ (its a modification of http://www.deimos.fr/gitweb/?p=nagios_p ... 45;hb=HEAD I have tested it from the command line as the nagios user and it works as expected)
in the file: /usr/local/nagios/etc/nrpe.cfg i added
command[check_wadmin]=/usr/bin/perl /usr/local/nagios/libexec/custom/check_wadmin.pl -f /tmp/nagiosInput.txt -i wait -n 35
On the monitoring machine
I already had the machine monitoring the remote linux box's basic stats, I did this by creating a remotelinuxhost.cfg file at /usr/local/nagios/etc/objects (and adding a reference in the main config)
To remotelinuxhost.cfg I added:
define service{
use generic-service ; Name of service template to use
host_name Sun89
service_description Check Feed Handler
check_command check_wadmin
}
I also added to the commands.cfg file (in the same folder)
#custom - 'check_wadmin' command definition
define command{
command_name check_wadmin
command_line check_nrpe
}
*NOTE: I also tried this but when I tried to reload the service it wouldn't accept it:
define command{
command_name check_nrpe
command_line /usr/bin/perl /usr/local/nagios/libexec/custom/check_wadmin.pl -f /tmp/nagiosInput.txt -i wait -n 35
}
The Nagios web interface now has the error message:
(Return code of 127 is out of bounds - plugin may be missing)
Anyone have any ideas? Any suggestions would be much appreciated!
To answer your question, I can run the plugin successfully from the command line as the nagios user (the box being monitored that is)
I am not sure what your second suggestion was, can you please elaborate?
Just an FYI, I also posted this question to the mailing list and they suggested I try adding the full path to the perl interpreter so I have tried the following now as well
On the machine being monitored
I have the perl script I created in /usr/local/nagios/libexec/custom/ (its a modification of http://www.deimos.fr/gitweb/?p=nagios_p ... 45;hb=HEAD I have tested it from the command line as the nagios user and it works as expected)
in the file: /usr/local/nagios/etc/nrpe.cfg i added
command[check_wadmin]=/usr/bin/perl /usr/local/nagios/libexec/custom/check_wadmin.pl -f /tmp/nagiosInput.txt -i wait -n 35
On the monitoring machine
I already had the machine monitoring the remote linux box's basic stats, I did this by creating a remotelinuxhost.cfg file at /usr/local/nagios/etc/objects (and adding a reference in the main config)
To remotelinuxhost.cfg I added:
define service{
use generic-service ; Name of service template to use
host_name Sun89
service_description Check Feed Handler
check_command check_wadmin
}
I also added to the commands.cfg file (in the same folder)
#custom - 'check_wadmin' command definition
define command{
command_name check_wadmin
command_line check_nrpe
}
*NOTE: I also tried this but when I tried to reload the service it wouldn't accept it:
define command{
command_name check_nrpe
command_line /usr/bin/perl /usr/local/nagios/libexec/custom/check_wadmin.pl -f /tmp/nagiosInput.txt -i wait -n 35
}
The Nagios web interface now has the error message:
(Return code of 127 is out of bounds - plugin may be missing)
Anyone have any ideas? Any suggestions would be much appreciated!
Re: Problem with custom plugin on a remote linux box
HI,
I have same isue with nagios i can run command successfull to check host from nagios server but my web interface is cotinusly giving this errorr.
"Return code of 127 is out of bounds - plugin may be missing"
Any solution please
I have same isue with nagios i can run command successfull to check host from nagios server but my web interface is cotinusly giving this errorr.
"Return code of 127 is out of bounds - plugin may be missing"
Any solution please
-
puckoff7337
- Posts: 3
- Joined: Thu Sep 02, 2010 1:36 am
Re: Problem with custom plugin on a remote linux box
Hi
I joined the mailing list to ask this question, gets much faster responses! They helped me get it working and here is how:
> I also added commands.cfg (in the same folder)
>
> #custom - 'check_wadmin' command definition
> define command{
> command_name check_wadmin
> command_line check_nrpe
> }
Bzzzt. Here's where it's incorrect.
check_nrpe only checks the status of the NRPE daemon on the remote
end. You need to use NRPE on the remote end to invoke your
check_wadmin test.
So, on your Nagios server, you need to set the command_line for the
check_wadmin command to something like:
$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_wadmin
$USER1$
^^^^^^^ The path to your local plugins (on the Nagios server)
check_nrpe
^^^^^^^^^^ Need to use check_nrpe to check the command on the
remote host
-H $HOSTADDRESS$
^^^^^^^^^^^^^^^^ What host to check
-c check_wadmin
^^^^^^^^^^^^^^^ What command to
run *ON THE
REMOTE HOST*
NRPE only allows you to run plugins designed to be local-only on
a remote system. You need to tell it *what* to run, and *how*
to run it.
I joined the mailing list to ask this question, gets much faster responses! They helped me get it working and here is how:
> I also added commands.cfg (in the same folder)
>
> #custom - 'check_wadmin' command definition
> define command{
> command_name check_wadmin
> command_line check_nrpe
> }
Bzzzt. Here's where it's incorrect.
check_nrpe only checks the status of the NRPE daemon on the remote
end. You need to use NRPE on the remote end to invoke your
check_wadmin test.
So, on your Nagios server, you need to set the command_line for the
check_wadmin command to something like:
$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_wadmin
$USER1$
^^^^^^^ The path to your local plugins (on the Nagios server)
check_nrpe
^^^^^^^^^^ Need to use check_nrpe to check the command on the
remote host
-H $HOSTADDRESS$
^^^^^^^^^^^^^^^^ What host to check
-c check_wadmin
^^^^^^^^^^^^^^^ What command to
run *ON THE
REMOTE HOST*
NRPE only allows you to run plugins designed to be local-only on
a remote system. You need to tell it *what* to run, and *how*
to run it.