Page 1 of 1

Warning state when critical event

Posted: Wed Sep 04, 2019 2:29 am
by tmvision
Hi,

I have this alias configured in nsclient.ini

CheckEventLog file=application "filter=generated gt -20h AND (level eq 'error' or level eq 'warning') and source eq 'MSSQLSERVER' and message like 'backup'" unique descriptions "top-syntax=${count} message(s): ${problem_list}"

Is it possible to return only a warning state when state is critical? I've tried with the warn filter but did not work.

Any help much appreciated.

Re: Warning state when critical event

Posted: Wed Sep 04, 2019 7:02 am
by scottwilkerson
I think you need to set the crit level to blank and change the warning levels

Code: Select all

CheckEventLog file=application "filter=generated gt -20h AND (level eq 'error' or level eq 'warning') and source eq 'MSSQLSERVER' and message like 'backup'" unique descriptions "top-syntax=${count} message(s): ${problem_list}" "warn=level in ('warning', 'error', 'critical')" "crit=level in ()"
By default they are

Code: Select all

warning 	level = ‘warning’, problem_count > 0
critical 	level in (‘error’, ‘critical’)

Re: Warning state when critical event

Posted: Wed Sep 04, 2019 7:30 am
by tmvision
scottwilkerson wrote:I think you need to set the crit level to blank and change the warning levels

Code: Select all

CheckEventLog file=application "filter=generated gt -20h AND (level eq 'error' or level eq 'warning') and source eq 'MSSQLSERVER' and message like 'backup'" unique descriptions "top-syntax=${count} message(s): ${problem_list}" "warn=level in ('warning', 'error', 'critical')" "crit=level in ()"
By default they are

Code: Select all

warning 	level = ‘warning’, problem_count > 0
critical 	level in (‘error’, ‘critical’)
Thanks for the reply, however nagios shows failure:

Code: Select all

Failed to validate filter see log for details: Warning expression is not valid: count>=level in ('warning', 'error', 'critical')

Re: Warning state when critical event

Posted: Wed Sep 04, 2019 8:10 am
by scottwilkerson
Their documentation is terrible, the only way I would see to get it to only give a warning is to set crit= to a really high value in the version I am running

for example

Code: Select all

CheckEventLog file=application "filter=generated gt -20h AND (level eq 'error' or level eq 'warning') and source eq 'MSSQLSERVER' and message like 'backup'" unique descriptions "top-syntax=${count} message(s): ${problem_list}" "crit=999999"

Re: Warning state when critical event

Posted: Thu Sep 05, 2019 1:43 am
by tmvision
scottwilkerson wrote:Their documentation is terrible, the only way I would see to get it to only give a warning is to set crit= to a really high value in the version I am running

for example

Code: Select all

CheckEventLog file=application "filter=generated gt -20h AND (level eq 'error' or level eq 'warning') and source eq 'MSSQLSERVER' and message like 'backup'" unique descriptions "top-syntax=${count} message(s): ${problem_list}" "crit=999999"
Yes we are using huge amounts of time to setup nagios.

Your example helped a lot, thanks.

I had to add "crit=999999" "warn=1" though, otherwise no warning would show.

Re: Warning state when critical event

Posted: Thu Sep 05, 2019 8:32 am
by scottwilkerson
tmvision wrote: Yes we are using huge amounts of time to setup nagios.

Your example helped a lot, thanks.

I had to add "crit=999999" "warn=1" though, otherwise no warning would show.
Great!

Locking thread