nrpe custom command problems

Jeff McKeon jsm at inpro.net
Tue Dec 17 18:53:46 CET 2002


Hey all,

I've written a plugin for nrpe to check the records in a database table
and then report warning or critical based on how many records are
returned.  The table is basically a mailserver pending message queue. 
The plugin, check_msgcount works fine if invoked by itself.  However
when I try to run it with check_nrpe localhost -c check_msgcount it
crashes out..  any ideas why?

nrpe is working fine with the standard plugins, check_disk etc...
Also, I did restart xinetd after adding the command line to the
nrpe.cfg.

*******************

nrpe.cfg file:

command[check_pendingmail]=/usr/local/nagios/libexec/check_msgcount

******************

if I run /usr/local/nagios/libexec/check_msgcount by itself it all runs
fine.  

If I run /usr/local/nagios/libexec//check_nrpe localhost -c
check_pendingmail as in below, the following happens...

[root at db02tc07927 libexec]# ./check_nrpe localhost -c check_pendingmail
s/libexec/check_msgcount: mysql: command not found
/usr/local/nagios/libexec/check_msgcount: [: -ge: unary operator
expected
/usr/local/nagios/libexec/check_msgcount: [: -ge: unary operator
expected


the check_msgcount file is this:

******************************************************************

#! /bin/sh
mysql telaurus -u nagios < /usr/local/nagios/libexec/messages.sql >
/usr/local/nagios/libexec/msg_count

numqueued=`grep -v COUNT /usr/local/nagios/libexec/msg_count`

if [    $numqueued -ge 2 ]; then
        echo "CRITICAL: $numqueued waiting messages in seaCOMM"
        exit 2;
fi

if [    $numqueued -ge 10 ]; then
        echo "WARNING: $numqueued waiting messages in seaCOMM"
        exit 1;
fi

echo "OK: $numqueued waiting messages in seaCOMM"
exit 0;

*********************************************************





-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/




More information about the Users mailing list