what is right format to check windows service with special?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
relateqld
Posts: 41
Joined: Sun Nov 11, 2012 8:15 pm

what is right format to check windows service with special?

Post by relateqld »

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?
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

Post by scottwilkerson »

This looks correct. Although you may need to use single quotes

What version of NSClient are you running?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
relateqld
Posts: 41
Joined: Sun Nov 11, 2012 8:15 pm

Re: what is right format to check windows service with speci

Post by relateqld »

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

Post by slansing »

Hi relateqld,

Have you tried pushing the check through as scott suggested? With single quotes?

Code: Select all

'string with strange characters inside'
relateqld
Posts: 41
Joined: Sun Nov 11, 2012 8:15 pm

Re: what is right format to check windows service with speci

Post by relateqld »

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
relateqld
Posts: 41
Joined: Sun Nov 11, 2012 8:15 pm

Re: what is right format to check windows service with speci

Post by relateqld »

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?
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

Post by scottwilkerson »

lets try

Code: Select all

/usr/local/nagios/libexec/check_nt -H raqsav1 -s "xxxx" -p 12489 -v SERVICESTATE -l 'sophos management service' -d SHOWALL 
I remember hearing about a bug in the new version of nsclient++ where services and processes need to be in all lower case...
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
relateqld
Posts: 41
Joined: Sun Nov 11, 2012 8:15 pm

Re: what is right format to check windows service with speci

Post by relateqld »

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?
relateqld
Posts: 41
Joined: Sun Nov 11, 2012 8:15 pm

Re: what is right format to check windows service with speci

Post by relateqld »

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
Locked