Page 1 of 1

help with check_wmi_plus regex

Posted: Thu Feb 21, 2019 10:29 am
by facc_se
we have 2 windows services named as follows (no quotes)
"service1"
"service1 - advanced"

running the following check_wmi_plus command matches on both services. I don't want it to match on both services, I only want it to match on "service1" not "service1 - advanced". I have reviewed the perl regex methodology and cant figure out how to exclude the text "- advanced". Any suggestions?

[nagios ~]$ /usr/local/nagios/libexec/check_wmi_plus.pl -H xxxx.yyyy.local -u '[email protected]' -p 'xxxxxxxx' -m checkservice -a 'service1' -c 0

CRITICAL - [Triggered by _NumBad>0] - Found 2 Services(s), 1 OK and 1 with problems (0 excluded). 'service1' (service1) is Running, 'service1 - advanced' (service1 - advanced) is Stopped.|'Total Service Count'=2; 'Service Count OK State'=1; 'Service Count Problem State'=1;0; 'Excluded Service Count'=0;

Re: help with check_wmi_plus regex

Posted: Thu Feb 21, 2019 3:10 pm
by npolovenko
Hello, @facc_se. You can add the exclude flag -o to your service check definition. Here's the syntax:
/usr/local/nagios/libexec/check_wmi_plus.pl -H xxxx.yyyy.local -u '[email protected]' -p 'xxxxxxxx' -m checkservice -a 'service1' -c 0 -o 'service1 - advanced'

Re: help with check_wmi_plus regex

Posted: Thu Feb 21, 2019 3:37 pm
by facc_se
that worked....thx so much!

Re: help with check_wmi_plus regex

Posted: Thu Feb 21, 2019 5:21 pm
by npolovenko
@facc_se, Great! Closing this as resolved.