Page 1 of 1

Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Mon Jun 12, 2017 11:39 am
by n8860104460
Hi Team,

while configuring MSSQL$MSSQLSERVER_2K12 Serive in Nagios i am getting error "Failed to open service: MSSQLMSSQLSERVER_2K12$"

Noteable Points :

1.Command which is i am using to check service state > ./check_nrpe -H usa****** -t 30 -c CheckServiceState -a ShowAll "MSSQL"$"MSSQLSERVER_2K12"
2.while checking status form CLI (Collector server) getting service status as OK.
3.While checking status form GUI ( if check test Command ) getting output as OK.
4.But when i save that configuration and wait for latest check getting error "Failed to open service: MSSQLMSSQLSERVER_2K12$"

After few search on Exchange found that this issue is due to special character and to skip this i have already used below paramater and still i am getting ok state on Point 2 and 3 but after save the command on Point 4 Output on GUI getting same error "Failed to open service: MSSQLMSSQLSERVER_2K12$"

Tried Paramaters.

"MSSQL"$"MSSQLSERVER_2K12"
'MSSQL"$"MSSQLSERVER_2K12'
MSSQL"$"MSSQLSERVER_2K12
MSSQL\$MSSQLSERVER_2K12
MSSQL\\\$$MSSQLSERVER_2K12
MSSQL$MSSQLSERVER_2K12
MSSQL\$\MSSQLSERVER_2K12"

Output from CLI from TWO Different Commands

./check_nt -H usa**** -v SERVICESTATE -d SHOWALL -l MSSQL"$"MSSQLSERVER_2K12 -p 12489
MSSQL$MSSQLSERVER_2K12: Started

./check_nrpe -H usa****** -t 30 -c CheckServiceState -a ShowAll MSSQL"$"MSSQLSERVER_2K12
OK: MSSQL$MSSQLSERVER_2K12: running|

./check_nrpe -H usa****** -t 30 -c CheckServiceState -a ShowAll 'MSSQL$MSSQLSERVER_2K12'
OK: MSSQL$MSSQLSERVER_2K12: running|


Please Advise.

Re: Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Mon Jun 12, 2017 12:51 pm
by tgriep
Try using the following for the service name in the command definition in XI.

Code: Select all

"MSSQL$"$"MSSQLSERVER_2K12"
I have found that escaping the $ with another $ seems to work consistently in the commands.

Re: Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Tue Jun 13, 2017 11:37 am
by n8860104460
I tried this parameters also but again getting same error.

Now Please see the attached error then you might be understand what actually i am trying to say.

Please follow attachment using steps.

Steps 1. CLI Output working fine with different parameters.
Steps 2. GUI Configuration working fine.
Steps 3. Output is in Error.

Re: Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Tue Jun 13, 2017 11:54 am
by tgriep
Try changing $ARG1$ to the following example, including the double quotes and the extra $ and see if the check functions in the GUI for you.

Code: Select all

"MSSQL$"$"MSSQLSERVER_2K12"

Re: Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Wed Jun 14, 2017 5:01 am
by n8860104460
Thank you for your guidance now output is coming as OK, but not able to understand one thing

while testing form Configuration panel I am getting error, and when i save same settings however output is in OK state.

Please see attached screen shot for more info.

Re: Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Wed Jun 14, 2017 10:32 am
by tgriep
When the Test Check button is used, it looks at the command and added extra escaping to the command if it finds special characters and sometimes it adds too much making the command fail.
Take a look in the screen shot and you will see that it added some back slashes which doubly escaped the $ causing an incorrect service name.

Re: Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Mon Jun 19, 2017 5:11 am
by n8860104460
Thank you so Much for your response and helping me to resolve the issue :)

Re: Failed to open service: MSSQLMSSQLSERVER_2K12$

Posted: Mon Jun 19, 2017 9:42 am
by tgriep
Your very welcome. I'll close and mark the post as solved. If you have any new questions in the future, feel free to open a new post.