Subject: expect: directive fails

From: Ivan <[email-masked]>
Date: Thu, 7 Apr 2011 13:03:57 -0700 (PDT)

Hi,

I have a command-alarm  that greps a logfile for the word 'error'.

my settings in the alarm says

Service prog   {
...
...
command:  grep 'error' somfile.log
expect: 
retries: 3

...
 }

Which should mean that if no text is returned, then the alarm should 
stay green right ??

Is this the proper setting for that behavior ?

THanks
Ivan G.

---

From: Jason Azze <[email-masked]>
Date: Thu, 7 Apr 2011 17:44:57 -0400

> Is this the proper setting for that behavior ?

Ivan,

The docs say:

expect a regular expression that needs to match the output from the command.
if not specified, the exit code from the program will be used to determine
success or failure.

grep returns nothing to stdout if it doesn't find your string, but it
returns 1 to stderr. So maybe try 1 for the expect: value.

Jason