NSClient++ Help (#1) - arguments ignored (#756) - Message List
I tried for some hours to get command arguments working, but no succes yet:
Nagios host: ./check_nrpe -H x.x.x.x -p yyyy -c mycheck -a 10 100 (built with ./configure --enable-ssl --enable-command-args)
NSCLient++ host (windows server 2003), NSC.ini contains these settings: CheckExternalScripts.dll use_ssl=1 allow_arguments=1 (is set twice) mycheck=java classxyz "C:\path\xy" %ARG1% %ARG2%
Basically it works as expected. The only thing is that the java program gets as parameters the strings "%ARG1$" and "$ARG2$" instead of the actual values "10" "100" from the Nagios host.
The log does not show any problem, there the values are listed: 2011-03-16 14:05:01: debug:NSClient++.cpp:1106: Injecting: mycheck: 10, 100
Setting the values directly works: mycheck=java classxyz "C:\path\xy" 10 100
Any idea what I have overseen?
This is an easy one to miss.
The case is the following:
There are two (2) module used when you check external scripts.
- NRPEHandler (accepts the call)
- CheckExternalScripts (executes the command)
Both these modules have the ability to allow (or disallow) arguments.
So what you have configure id:
- check_nrpe with arguments
- NRPEListener with arguments
- CheckExternalScripts without arguments
So add the same to the CheckExternalScripts module if you want to allow arguments all the way.
The reason for this is that it is not uncommon for instance to want to allow arguments to internal commands like CheckCPU but NOT to external Commands like scripts. The (main) reason for disallowing arguments is security when forking things via the shell.
Another scenario is if you are relaying on a "alias facade" in essence allowing only your internal commands (read aliases) to use arguments but not remote commands (coming in via NRPE).
Michael Medinmickem03/17/11 08:14:38 (2 years ago)