Page 1 of 1

WMI Servicecheck SQL instance - special character

Posted: Mon Nov 03, 2014 6:34 pm
by OptimusB
I am trying to monitor a MSSQL service and the service name has a special character $ in it. I am using WMI plus with checkservice for this. When testing the command with core config manager, it seems to work. But when I check the dashboard it says 0 services found.

Here's the test command (modified service name, but kept the $ character) output from XI CCM.

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_wmi_plus.pl -H 192.168.1.15 -u 'user' -p 'password' -m checkservice -a 'MSSQL\$INSTANCE'
OUTPUT: OK - Found 1 Services(s), 1 OK and 0 with problems (0 excluded). 'SQL Server (INSTANCE)' (MSSQL$INSTANCE) is Running.|'Total Service Count'=1; 'Service Count OK State'=1; 'Service Count Problem State'=0; 'Excluded Service Count'=0;
Noticed that it put the "\" character in the command even when I used the arguement: -a 'MSSQL$INSTANCE'. This is fine but once I apply configuration and check the host, I am seeing the following status message

Code: Select all

OK - Found 0 Services(s), 0 OK and 0 with problems (0 excluded).
I've had ran into similar problem with Core, but I was able to get it to recognize the $ sign. I am not sure what's required in XI in order for this to check the SQL service properly?

Thanks in advance.

Re: WMI Servicecheck SQL instance - special character

Posted: Tue Nov 04, 2014 4:24 pm
by abrist
The dollar sign needs to be escaped in the arg with one of the two following examples (depending on the plugin):

Code: Select all

MSSQL\$INSTANCE
Or:

Code: Select all

MSSQL$$INSTANCE

Re: WMI Servicecheck SQL instance - special character

Posted: Tue Nov 04, 2014 11:44 pm
by OptimusB
Here are the results:

Using "MSSQL$$INSTANCE"

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_wmi_plus.pl -H 192.168.1.15 -u 'user' -p 'password' -m checkservice -a MSSQL\$\$INSTANCE
OUTPUT: OK - Found 0 Services(s), 0 OK and 0 with problems (0 excluded). |'Total Service Count'=0; 'Service Count OK State'=0; 'Service Count Problem State'=0; 'Excluded Service Count'=0;
Using "MSSQL\$INSTANCE"

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_wmi_plus.pl -H 192.168.1.15 -u 'user' -p 'password' -m checkservice -a MSSQL\\\$INSTANCE
OUTPUT: OK - Found 1 Services(s), 1 OK and 0 with problems (0 excluded). 'SQL Server (INSTANCE)' (MSSQL$INSTANCE) is Running.|'Total Service Count'=1; 'Service Count OK State'=1; 'Service Count Problem State'=0; 'Excluded Service Count'=0;
With the second one, I am still only getting "OK - Found 0 Services(s), 0 OK and 0 with problems (0 excluded)." when viewing in the dashboard.

Re: WMI Servicecheck SQL instance - special character

Posted: Wed Nov 05, 2014 10:48 am
by abrist
Do not use the "test check command" to verify these escape patterns as the test *adds* escaping. Are you a client? If so, send an email to [email protected] to open a ticket and we will remote in and fix this.

Re: WMI Servicecheck SQL instance - special character

Posted: Thu Nov 06, 2014 2:08 am
by OptimusB
I am currently putting together a demo for a client to review.
I have tried both suggestions and ignoring the test command results. However in both situations the status of the service check outputs the following as mentioned.

Code: Select all

"OK - Found 0 Services(s), 0 OK and 0 with problems (0 excluded)."
I have a similar setup with Core for a SQL Express instance "MSSQL$INSTANCE". However in that scenario I am using check_NT with NSClient++ and my check command is format as such in the cfg. I've tried this with the XI setup, but could not get it to work.

Code: Select all

check_command           check_nt!SERVICESTATE!-d SHOWALL -l MSSQL"$$"CORPBC

Re: WMI Servicecheck SQL instance - special character

Posted: Thu Nov 06, 2014 3:09 am
by OptimusB
Ok. So I was able to fix this issue by going into the CFG file of the service and manually editing the check command.

Code: Select all

check_command                   check_xi_service_wmiplus!'user'!'password'!checkservice!-a 'MSSQL\$INSTANCE'!!!!
By default, no matter what I do within XI CCM, this will NOT put that into the CFG file. (I checked the file after each suggest edit from above)

I finally got the result I wanted in the dashboard.

Code: Select all

OK - Found 1 Services(s), 1 OK and 0 with problems (0 excluded). 'SQL Server (VIM_SQLEXP)' (MSSQL$INSTANCE) is Running

Re: WMI Servicecheck SQL instance - special character

Posted: Thu Nov 06, 2014 11:45 am
by lmiltchev
I am glad your issue has been resolved! I am locking this topic. If you have any more questions/issues, please start a new thread.