Page 1 of 2
Service Monitoring with Special Characters
Posted: Wed Jul 13, 2016 10:30 am
by Pponze
We have a Windows Internal Database for WSUS we'd like to monitor. How do we go about monitoring this service due to the special characters in the name?
Service name: MSSQL$MICROSOFT##WID
define service{
use generic-service
host_name VCAUTIL01
service_description MSSQL$MICROSOFT##WID
event_handler win_service_restart
event_handler_enabled 1
check_command check_nt!SERVICESTATE!-d SHOWALL -l $SERVICEDESC$
}
Thanks,
Paolo
Re: Service Monitoring with Special Characters
Posted: Wed Jul 13, 2016 12:56 pm
by rkennedy
Try changing the $ to "$$" (with the double quotes), I'm not sure if you'll need to escape out the ## or not. Could you try this, and let us know what the check is reporting?
Re: Service Monitoring with Special Characters
Posted: Wed Jul 13, 2016 12:59 pm
by bwallace
Your service definition will need a backslash \ and two $$ signs.
MSSQL\$$INSTANCE
Refer to this doc
https://support.nagios.com/kb/article.php?id=168
Re: Service Monitoring with Special Characters
Posted: Thu Jul 14, 2016 4:09 pm
by Pponze
Thanks for the tips and link. Tried both "$$" and \$$. Got a check error. I did rule out that the ## doesn't require an escape. Ran a check with the name MSSQLMICROSOFT##WID and it passed.
Re: Service Monitoring with Special Characters
Posted: Thu Jul 14, 2016 4:44 pm
by Box293
Is it resolved?
If not, can you show us your testing command from the command line and the output produced.
Re: Service Monitoring with Special Characters
Posted: Thu Jul 14, 2016 4:57 pm
by Pponze
Unfortunately it's not resolved. Here is the command:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Re: Service Monitoring with Special Characters
Posted: Thu Jul 14, 2016 5:03 pm
by Box293
Please show us your check_nt command at the command line along with the output. Before making it work in Nagios, lets see it working on the command line first.
Re: Service Monitoring with Special Characters
Posted: Mon Jul 18, 2016 4:08 pm
by Pponze
Box293, would this be the correct command to run check_nt?
/usr/local/nagios/libexec/check_nt -H x.x.x.x -v SERVICESTATE -d SHOWALL -l 'MSSQL\$$MICROSOFT##WID'
Re: Service Monitoring with Special Characters
Posted: Mon Jul 18, 2016 4:15 pm
by tgriep
Try running the command like the example below and see if this works for you
Code: Select all
/usr/local/nagios/libexec/check_nt -H x.x.x.x -v SERVICESTATE -d SHOWALL -l "MSSQL$"$"MICROSOFT##WID"
Re: Service Monitoring with Special Characters
Posted: Mon Jul 18, 2016 4:40 pm
by Pponze
Ran the suggested command and got this response:
root@nagios:/# /usr/local/nagios/libexec/check_nt -H 1.2.3.4 -v SERVICESTATE -d SHOWALL -l "MSSQL$"$"MICROSOFT##WID"
Connection refused
could not fetch information from server
root@nagios:/#
Got the same results pointing to the WSUS service which we're monitoring that service successfully.
root@nagios:/# /usr/local/nagios/libexec/check_nt -H 1.2.3.4 -v SERVICESTATE -d SHOWALL -l "WsusService"
Connection refused
could not fetch information from server
root@nagios:/#