what is right format to check windows service with special?
what is right format to check windows service with special?
use check_xi_service_nsclient command to check the status of windows service, but get problem with service name contains special character like $, (, space and so on.
For example, "sophos management service" contains 2 space in the name, had tried sophos management service and "sophos management service", both return
could not fetch information from server
So what is right format for such service name?
For example, "sophos management service" contains 2 space in the name, had tried sophos management service and "sophos management service", both return
could not fetch information from server
So what is right format for such service name?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: what is right format to check windows service with speci
This looks correct. Although you may need to use single quotes
What version of NSClient are you running?
What version of NSClient are you running?
Re: what is right format to check windows service with speci
I am using newest version of nsclient++, 0.4.1.66.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: what is right format to check windows service with speci
Hi relateqld,
Have you tried pushing the check through as scott suggested? With single quotes?
Have you tried pushing the check through as scott suggested? With single quotes?
Code: Select all
'string with strange characters inside'Re: what is right format to check windows service with speci
Test check command results:
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'Sophos Management Service' -d SHOWALL
OUTPUT: could not fetch information from server
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l \`Sophos Management Service\` -d SHOWALL
OUTPUT: could not fetch information from server
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'Sophos Management Service' -d SHOWALL
OUTPUT: could not fetch information from server
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'Sophos Management Service' -d SHOWALL
OUTPUT: could not fetch information from server
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l \`Sophos Management Service\` -d SHOWALL
OUTPUT: could not fetch information from server
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'Sophos Management Service' -d SHOWALL
OUTPUT: could not fetch information from server
Re: what is right format to check windows service with speci
My bad, single quote did work for space, there is something wrong with nsclient in that server.
Can you also tell me how to escape from other special character like $?
see below:
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'MSSQL\$SOPHOS' -d SHOWALL
OUTPUT: MSSQL\$SOPHOS: Error
When the service name contains $, nagios will auto add \ in front of $, how to escape?
Can you also tell me how to escape from other special character like $?
see below:
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'MSSQL\$SOPHOS' -d SHOWALL
OUTPUT: MSSQL\$SOPHOS: Error
When the service name contains $, nagios will auto add \ in front of $, how to escape?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: what is right format to check windows service with speci
lets try
I remember hearing about a bug in the new version of nsclient++ where services and processes need to be in all lower case...
Code: Select all
/usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'sophos management service' -d SHOWALL Re: what is right format to check windows service with speci
Hi scottwikerson:
single quote works for space, so lower case or upper case doesn't matter.
Now I am trying to find a way to esacpe $, do you know how?
single quote works for space, so lower case or upper case doesn't matter.
Now I am trying to find a way to esacpe $, do you know how?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: what is right format to check windows service with speci
I tried that before, not working with nagios xi
check_nt!SERVICESTATE!-d SHOWALL -l MSSQL\\$$INSTANCE
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l MSSQL\\\\\$\$SOPHOS -d SHOWALL
OUTPUT: MSSQL\\$$SOPHOS: Error
check_nt!SERVICESTATE!-d SHOWALL -l MSSQL\\$$INSTANCE
COMMAND: /usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l MSSQL\\\\\$\$SOPHOS -d SHOWALL
OUTPUT: MSSQL\\$$SOPHOS: Error