NSClient++ Help (#1) - NSClient Works From Command Line But Not Nagios [SOLVED] (#633) - Message List

NSClient Works From Command Line But Not Nagios [SOLVED]

Hi all,

I am just starting to look into using NSClient++ with NRPE for getting performance counter information from my Windows servers but am getting stuck once I create the command in Nagios.

I run the following directly from /usr/local/nagios/libexec/:

./check_nrpe -H 172.29.2.33 -c CheckCounter -a "Counter=\MSMQ Queue(rpl-triumph\private$\accu)\Messages in Queue" ShowAll MaxWarn=100 MaxCrit=5000

I get the following result which is correct:

OK: \MSMQ Queue(rpl-triumph\private$\accu)\Messages in Queue: 0|'\MSMQ Queue(rpl-triumph\private$\accu)\Messages in Queue'=0;100;5000;

However, when I create this as a command within nagios (actually through NagiosQL) I get the following within the nsclient.log file on the remote Windows server:

2010-07-26 15:52:17: error:modules\CheckSystem\CheckSystem.cpp:1082: ERROR: Counter not found: \MSMQ Queue(rpl-triumph\private$\accu)\Messages in Queue$: The specified counter could not be found.   (C0000BB9)

It appears to be adding a $ at the end of the command but am not sure why! Here is the command:

$USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckCounter -a "Counter=$ARG1$" ShowAll MaxWarn=$ARG2$ MaxCrit=$ARG3$

And here is $ARG1$:

\\MSMQ Queue(rpl-triumph\\private$\\accu)\\Messages in Queue

Anyone got any ideas where I am going wrong?

Thanks.

Pete.

  • Message #1899

    You most likely need to escape various chars (check the FAQ) $ for instance and \ and such...

    // Michael Medin

    • Message #1907

      Thanks for the reply. Problem was obvious after you comment as just needed to modify my $ARG1$ to include two $'s:

      \\MSMQ Queue(rpl-triumph\\private'''$'''$\\accu)\\Messages in Queue
      

      Thanks for the help.

      • Message #1908

        I think you can do $$ in nagios to escape the 4...

        // Michael Medin

Subscriptions