Filter check_nrpe by string in the message

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MatteoHD
Posts: 1
Joined: Fri Apr 15, 2016 10:23 am

Filter check_nrpe by string in the message

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Filter check_nrpe by string in the message

Post 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'"
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked