Page 1 of 1

Filter check_nrpe by string in the message

Posted: Fri Apr 15, 2016 10:35 am
by MatteoHD
Hi All,

I'm trying to filter the email automatically sent by nagios applying a filter based on string in the message.

The original command is: check_nrpe -H $HOSTNAME$ -p 5666 -c CheckEventLog -a file=application MaxWarn=1 MaxCrit=1 "filter=generated > -1h AND severity = 'error'"

and I tried to add message filter in this way: check_nrpe -H $HOSTNAME$ -p 5666 -c CheckEventLog -a file=application MaxWarn=1 MaxCrit=1 "filter=generated > -1h AND severity = 'error' AND NOT message like 'test' "

but it obviously does not work.

What I'm trying to do is a command who filters message by string, for example if in the error message shows 'Service Control Manager'.

Can anyone help me, please?

Thank in advance.

Re: Filter check_nrpe by string in the message

Posted: Fri Apr 15, 2016 1:32 pm
by tgriep
Are you looking for a warning or critical is the severity = error and the message contains 'Service Control Manager'?
If so, the command should look like this

Code: Select all

check_nrpe -H $HOSTNAME$ -p 5666 -c CheckEventLog -a file=application MaxWarn=1 MaxCrit=1 "filter=generated > -1h AND severity = 'error' AND message like 'Service Control Manager'"
The opposite would be

Code: Select all

check_nrpe -H $HOSTNAME$ -p 5666 -c CheckEventLog -a file=application MaxWarn=1 MaxCrit=1 "filter=generated > -1h AND severity = 'error' AND message not like 'Service Control Manager'"