check_nt escape sequence


Hello Everyone!
I was configuring the check_nt script and then came across the problem when the service had the & in it’s name.
Tried standard unix escape sequence with & , even && but it all failed to get the result.
This command works:
[root@localhost libexec]#./check_nt -H servername -p 12489 -v SERVICESTATE -d SHOWALL -l Intercom\ Server
Intercom Server: Started
also the following works:
[root@localhost libexec]# ./check_nt -H servername -p 12489 -v SERVICESTATE -d SHOWALL -l "Intercom Server"
Intercom Server: Started
But when trying with & in the parameters:
[root@localhost libexec]# ./check_nt -H servername -p 12489 -v SERVICESTATE -d SHOWALL -l "Time&Space Event Collector"
Time: Not found - Space Event Collector: Not found
[root@localhost libexec]# ./check_nt -H servername -p 12489 -v SERVICESTATE -d SHOWALL -l Time&Space\ Event\ Collector
Time: Not found - Space Event Collector: Not found
Neither command is working.
Am I missing something or check_nt plugin has some difficulties with the & character?
I am sorry if this was answered before but I tried the search the forum for “escape sequence” and googling for “nagios escape sequence” and “check_nt escape &” and I ran out of ideas.
Thank you for your answers.


\& works well often in nagios (viewtopic.php?f=62&t=4394&p=15392&hilit=escape+%26#p15392) - you may or may not get similar success with this. Worth a shot :slight_smile:




Thanks for your reply.
Doesn’t work either. I still get an error like this:
Time: Error - Space\ Event\ Collector: Error
And it causes bash to fork the process too.
Any other ideas?


I’m getting the feeling that this might not be possible to do… :frowning:

You may have to resort to writing a script locally using some function like sysinternals’ pstools program to ascertain the service status and then call that script using nrpe…

You could try taking a look at the nsclient++ site and forums at to see if there’s anything there, though I’ve had a cursory glance around and haven’t found anything of use… Michael Medin (nsclient++ author) appears to have some sort of online chat facility there along with various other contact details, so assuming that works and you can catch him online, mebey ask him if he’s ever come across your check_nt/ampersand issue - I reckon if anyone would know a workaround, it would be him

Best of luck