2

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?

EDIT:

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.

EDIT:

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

Robin M
  • 453
  • 2
  • 8
  • 14

3 Answers3

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:

debug_level=-1
debug_verbosity=2
# DEBUG FILE
debug_file=/usr/local/nagios/var/nagios.debug
max_debug_file_size=1000000

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.

Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
0

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

hope this helps -> Link <-

Rodent43
  • 697
  • 3
  • 11
0

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".

EDIT:

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
Robin M
  • 453
  • 2
  • 8
  • 14