attempt recovery on service CRITICAL with nrpe

Steve Bonds r1p6os402 at sneakemail.com
Thu Jan 23 03:40:22 CET 2003


This is probably drifting dangerously offtopic into "stupid grep tricks",
but here's what I use:

Instead of:

ERS=`ps -eaf | grep ns-slapd | grep -v "grep" | wc -l`

use:

ERS=`ps -eaf | grep [n]s-slapd | wc -l`

The [] is normally used to match one of many chars.  In this case it only
matches one.  The "[n]" literal shows up in the process list on the grep
command.  However, [n] evaluated by grep down to become "n" does not match
the "[n]" it sees in the process list so your grep won't show up.

It'll make more sense if you just try it.  ;-)

  -- Steve

On Wed, 22 Jan 2003, Jamin jragle-at-unm.edu |Nagios| wrote:

> It does not matter the order in this case.
> Test it out.  As long as the grep is striped out before you do the word 
> count, you are cool.
> 
> -Jamin
> 
> On Wed, 22 Jan 2003, donavan nelson wrote:
> 
> > you have that backwards...
> > 
> > ERS=`ps -eaf | grep -v grep | grep ns-slapd | wc -l`
> > 
> > should be
> > ERS=`ps -eaf | grep ns-slapd | grep -v "grep" | wc -l`
> > 
> > the second grep "could" make an appearance.



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