Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to monitor an MSMQ queue counter using Nagios (3.0.1). The remote server is running NC_Net. The check_command config looks like this:

check_command check_nt!COUNTER!-l "\\MSMQ Queue(servername\\private$\\queuename)\\Messages in Queue","%.f messages in MSMQ queue" -w 5 -c 10

This doesn't work. I believe that the dollar symbol needs to be escaped and I'm having trouble working out how.

This article suggests "$$" ie.

check_command check_nt!COUNTER!-l "\\MSMQ Queue(servername\\private"$$"\\queuename)\\Messages in Queue","%.f messages in MSMQ queue" -w 5 -c 10

but that doesn't work. I've tried a few other methods (backslash, single quotes etc).

Any suggestions?


I've been doing some testing via the command line which is one reason I believe it's the $ causing the problem. The following works:

./check_nt -H hostip -v COUNTER -l "\\MSMQ Queue(Computer Queues)\\Messages in Queue","%.f messages in MSMQ queue" -w 5 -c 10

but this doesn't:

./check_nt -H hostip -v COUNTER -l "\\MSMQ Queue(servername\\private$\\queuename)\\Messages in Queue","%.f messages in MSMQ queue" -w 5 -c 10

I've also used ECHO to see how those commands expand but that hasn't helped me.


Turns out it wasn't the dollar symbol. See below.

share|improve this question
You might want to include the service and host definitions too, that way we get the whole picture. –  Kyle Brandt Jul 29 '09 at 12:25
What is ECHO , that nagios thing? –  Kyle Brandt Jul 29 '09 at 12:34
ECHO expands the command line –  Robin M Jul 29 '09 at 12:52

3 Answers 3

You can enable full debugging in the nagios.cfg to see what the command actually expands to, this will show you if the dollar sign is actually the problem. To do this, set the following:


If you have a lot of checks, you need to set the max debug file size because at that verbosity and level the log fills up quick.

And them maybe (example):

sudo /etc/init.d/nagios reload

You will then need to run check, while tailing the log. You also might want to pipe the tail to grep with something like 'check_nt' so you can lessen the noise.

share|improve this answer
I'll give that a go, thanks –  Robin M Jul 29 '09 at 12:18

I believe you need to use \ to escape the character but the following link shows you might need two \

hope this helps -> Link <-

share|improve this answer
up vote 0 down vote accepted

I've discovered that NC_Net on the remote server logs to the Windows event log. Looking at the errors, I'm starting to think that it's not a problem with the dollar symbol:

I've run a couple of tests (that I expect to fail). For the first, I specified the counter name as "\MSMQ Queue(servername)\Messages in Queue"

The resulting error was:

Exeption occured during Counter check :Instance 'servername' does not exist in the specified Category.::>\MSMQ Queue(servername)\Messages in Queue

In that case, it can't find the counter instance. For the second, I specified "\MSMQ Queue(servername\test1)\Messages in Queue"

Exeption occured during Counter check :Could not locate Performance Counter with specified category name 'MSMQ Queue', counter name 'test1)\Messages in Queue'.::>\MSMQ Queue(servername\test1)\Messages in Queue

In that case, it can't find the counter.

It looks to me like NC_Net is parsing the counter names differently because of the \ in "servername\test1".


The problem was due to the \ in the counter instance name. I've discovered that there is an alternative syntax for specifying the counter name so the following works:

^MSMQ Queue^servername\\private\$\\queuename^Messages in Queue
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.