nrpe custom command problems

Volker.Aust at premiere.de Volker.Aust at premiere.de
Wed Dec 18 15:19:29 CET 2002


a few hints:

- put in the full path to mysql into the script.

- put in the full path to grep into the script.

- test your plugin script with the user "nagios", like jc suggested.

- my mysgl uses shared libraries. When your script is called from nrpe,
there is only a very limited environment. Be sure that mysql find all shared
libraries. On Solaris you can set LD_LIBRARY_PATH in your script to ensure
that or you can set a global path for shared libraries (crle for Solaris,
ld_config for Linux(?)).

-vol

> -----Original Message-----
> From: Jeff McKeon [mailto:jsm at inpro.net]
> Sent: Wednesday, December 18, 2002 2:39 PM
> To: Carroll, Jim P ""[Contractor]
> Cc: Nagios List
> Subject: RE: [Nagios-users] nrpe custom command problems
> 
> 
> nrpe runs under the user nagios, at least thats whats in the xinetd
> startup script.  It is a /bin/bash shell script.  If I take out the
> mysql command from the scrip nrpe runs it fine.  The problem 
> seems to be
> that nrpe doesn't recognize the mysql command as a real command.  Why
> this matters I'm not sure because shouldn't nrpe just run the 
> script and
> wait for output?
> 
> I haven't tried to run it with check_by_ssh because OpenSSH on the
> target machine is very old, has never been set up correctly 
> and I really
> don't want to start patching the hell out of a machine I'll probably
> just rebuild in a month or two (If I have my way).  Long story there,
> classic battle between development and operations.
> 
> On Tue, 2002-12-17 at 16:29, Carroll, Jim P [Contractor] wrote:
> > What user do you normally run nrpe from?  When you tested 
> the plugin, did
> > you test it under that user?  Can you kick off your command 
> from your Nagios
> > server using check_by_ssh?  (You'll need to set up a null 
> passphrase in
> > order for this to work.)
> > 
> > What's the plugin written in?  If it's a /bin/bash script, 
> try changing that
> > to /bin/sh .
> > 
> > Will the plugin run if invoked using 'at' or 'cron'?
> > 
> > Food for thought.
> > 
> > jc
> > 
> > > -----Original Message-----
> > > From: Jeff McKeon [mailto:jsm at inpro.net]
> > > Sent: Tuesday, December 17, 2002 11:54 AM
> > > To: Nagios List
> > > Subject: [Nagios-users] nrpe custom command problems
> > > 
> > > 
> > > 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/
> > > _______________________________________________
> > > Nagios-users mailing list
> > > Nagios-users at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/nagios-users
> > > 
> 
> 
> 
> 
> -------------------------------------------------------
> 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/
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> 


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