Problem with custom plugin on a remote linux box

Roderick Andrew Clemente rod at mwave.co.jp
Fri Sep 17 12:28:36 CEST 2010


Hi Benny and Nagios People,

Sorry for my delayed response, my boss pulled me off this project and we
have been so swamped I didn't get to come back to it until today!  
Thanks for your help but I still am not quite there, based on what you
directed below I now have the following configuration:

**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_plugins.git;a=blob;f=check_file_conten
t/check_file_content.pl;h=ecf737389fd5a4360ee864eb55aca92056308445;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 commands.cfg (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)

Any ideas on what I am doing wrong here? 

Thanks again,
Roderick

-----Original Message-----
From: C. Bensend [mailto:benny at bennyvision.com] 
Sent: Thursday, September 02, 2010 7:13 PM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Problem with custom plugin on a remote linux box


> 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

Always use the full path to interpreters, as the Nagios environment is not
the same as a normal shell user's.

> 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 }

Same with here.

> 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!!!

The command you have created above expects the check command to be on the
local (Nagios) server, *not* the remote client.  I don't think that's what
you intend.  Since your custom plugin is on the remote server and is
configured within NRPE to be run, you need to use check_nrpe on the Nagios
server to test it.

Modify the check_wadmin command on the Nagios server to use the check_nrpe
command to test it on the remote server, and I think you'll probably be OK.

Benny


--
"Because you have arms like noodles, while I am vigorous and
burly."                               -- Hodgins, "Bones"



----------------------------------------------------------------------------
--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list