check_nt with $ in service name?

I’m trying to check a service’s status with check_nt. The service has a $ sign in its name and I can’t change that. The following command works fine in a terminal window if issued manually - please note the simple quotes surrounding the service$name, which seems to be needed in this case:

check_nt -H -v SERVICESTATE -l ‘service$name’

However, when Nagios does its check, it strips the simple quotes (which is good) and appends an extra $ at the end (which is not good at all). I get the following warning in Nagios:

service$name$: Unknown

Does anyone know how to check such services?

Thanks,
Zoltan

try escaping the $ with a \
‘service\$name’

Luca

PS: Even this forum needs backslashes to be escaped… duh… :shock:
Edited Thu Aug 25 2005, 04:37AM ]

Thanks Luca. With the escaped $ Nagios builds the full service$name correctly without the need to use the simple quotes, but it still appends the extra $ at the end, like service$name$.

I could probably create a dummy service with a proper name and make it dependent on the service$name service so that when the real service goes down, then the dummy will stop too, and monitor the dummy one in Nagios. I just want to avoid it if possible.

Have you got any more ideas why would Nagios append the $?

Found the answer in the SourceForge nagios-users mailing list.
Escape the $ with a $, so that the command looks like this:

check_NT -H -v SERVICESTATE -l service$$name

Works well on Nagios 2.0b4.

Sorry folks, this forum removed the backslash from before the $$.
I appeal to your imagination. There is supposed to be a leading backslash in front of $$.

Enjoy.

nice to know so it’s
check_NT -H -v SERVICESTATE -l service\$$name
:wink:

Luca
Edited Thu Aug 25 2005, 11:20PM ]

Thanks Luca, that’s exactly it.

How would this apply to a service that has a space in the name.

i.e. Service Name Here and not ServiceNameHere

I ended up using a \ to espace the space.