attempt recovery on service CRITICAL with nrpe

donavan nelson donavan at 4wx.net
Thu Jan 23 00:58:08 CET 2003


I'll try this again and include the list :)

I would really clean up the following a bit.  

ERS=`ps -eaf | grep ersjsf | wc -l`

This removes the ambiguity of counting the grep process

ERS=`ps -ef | grep ersjsf | grep -v  "grep" -c`

Because the way your script is written, the first grep could return 0 and you
would fall out and exit with 0.

.dn
--
Donavan Nelson
4wx Networks
www.4wx.net

---------- Original Message -----------
From: Rasmus Plewe <rplewe at ess.nec.de>
To: nagios-users at lists.sourceforge.net
Sent: Thu, 23 Jan 2003 00:16:12 +0100
Subject: Re: [Nagios-users] attempt recovery on service CRITICAL with nrpe

> Hello,
> 
> On Wed, Jan 22, 2003 at 10:23:49AM -0700, Jamin wrote:
> > Hey all,
> > 	I was wondering if any of you have tried to use nrpe to fix 
> > problems on systems before any paging occurs.  Basically I have an LDAP 
> > service running on a remote machine and I would like to set up nagios with 
> > nrpe to try to restart the service when it detects that it has gone down.
> 
> if you don't mind an example without the context, where you have to
> extract the principle yourself:
> 
> #!/bin/sh
> 
> ERS=`ps -eaf | grep ersjsf | wc -l`
> 
> if [ $ERS -eq 2 ] || [ $ERS -eq 3 ]
>   then
>     /bin/echo "ERS OK - ERS running"
>     exit 0
> fi
> 
> if [ $ERS -eq 1 ]
>   then
>     sleep 20
>     ERSLATE=`ps -eaf | grep ersjsf | wc -l`
>     if [ $ERSLATE -eq 1 ]
>       then
>         /etc/rc2.d/S99ers start
>       else
>         /bin/echo "ERS OK - ERS running" 
>         exit 0 
>     fi
>     /bin/echo "ERS CRITICAL - not running, attempted to restart"
>     exit 2
> fi
> 
> Regards,
>          Rasmus
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Scholarships for Techies!
> Can't afford IT training? All 2003 ictp students receive 
> scholarships. Get hands-on training in Microsoft, Cisco, Sun,
>  Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp
_______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
------- End of Original Message -------



-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp




More information about the Users mailing list