Shinken/Nagios/Check_WMI_Plus Filtering

So I have a few windows servers getting checked with CHECK_WMI_PLUS. I am using Shinken as the service instead of Nagios.

When using the Windows Pack I was frustrated because part of the checks are looking to services that are set to AUTO and reporting an error if they are not started. This is all fine until you have a service such as the .NET4 services that are designed to be set to AUTO, but not be on all the time.

Unfortunately its a very difficult thing to find good documentation on CHECK_WMI_PLUS.
On their site, they explained the use of the ‘-o’ operator. But this would only take one argument.

Enter the manpage.

Explicity stated under “checkservice” is:
“ARG2 A regular expression that matches against the short or long service name that can be seen in the properties of the
service in Windows. The matching services are excluded in the resulting list.”

Regular Expression. Therefore it all made sense.

(ShortServiceName)|(ShortServiceName) will do the trick.

Adding this to the commands.cfg in the /etc/shinken/packs/windows did the trick. I created a new command:

# Auto services are started2
define command {
command_name check_windows_auto_services2
command_line $PLUGINSDIR$/check_wmi_plus.pl -H $HOSTADDRESS$ -u “$_HOSTDOMAINUSER$” -p “$_HOSTDOMAINPASSWORD$” -m checkservice -a Auto -o “(ShortServiceName)|(ShortServiceName)|(ShortServiceName)|(ShortServiceName)” -w $_HOSTWINDOWS_AUTO_SERVICES_WARN$ -c $_HOSTWINDOWS_AUTO_SERVICES_CRIT$ –inidir=$WMI_INI_DIR$