expect: directive fails

Jason Azze jason at azze.org
Thu Apr 7 17:44:57 EDT 2011


On Thu, Apr 7, 2011 at 4:03 PM, Ivan <happisnappy at yahoo.com> wrote:

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

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


More information about the Arguslist mailing list