NSClient++ Help (#1) - Passing Arguments to External Scripts (#165) - Message List

Passing Arguments to External Scripts

Hello guys,

I have a problem with a test instalation of NSClient. I'm using the last nightly build of NSClient (0.3.2.9 2008-05-17 w32)

My problems is that I'have created a simple VBS Script to check problems on a specific spooler queue. This scripts requies 2 parameters, the host that have this queue and thye queue name (of course, the first parameter is not necesary for localhost)

In the main part of the script, I'have checked that the params are ok before running the process:

If WScript.Arguments.Count = 2 Then
	strComputer=WScript.Arguments(0)
	strJobQueue=WScript.Arguments(1)
	if strComputer="$arg1$" then
		WScript.Echo "Incorrect Parameters (" & WScript.Arguments.Count & "): " & strComputer & " - " & strJobQueue
		retvalue=IntCritical
	else
.
.
.
.
.

Next I've defined the External Script in the NCS.INI file:

[External Script]
command_timeout=300
allow_arguments=1
;allow_nasty_meta_chars=0
;script_dir=c:\Scripts
[External Scripts]
CHECK_SPOOLJOBS=cscript.exe //NoLogo "C:\Program Files\NSClient++\Scripts\check_spooljobs.vbs" $arg1$ $arg2$

And after saving files and restarting the NSClient service, form the nagios box I test it:

./check_nrpe -H 172.16.98.22 -n -c CHECK_SPOOLJOBS -a "localhost" "Brother MFC-7225N Printer"

But I gave this result:

Incorrect Parameters (2): $arg1$ - $arg2$

The parameters are not passed to the script, they have the string value!

Checking the nsclient.log, I see this:

2008-06-06 16:36:26: debug:.\NSClient++.cpp:516: Injecting: CHECK_SPOOLJOBS: QUEUE, Brother MFC-7225N Printer
2008-06-06 16:36:26: debug:.\NSClient++.cpp:536: Injected Result: CRITICAL 'Parametros incorrectos (2): $arg1$ - $arg2$'
2008-06-06 16:36:26: debug:.\NSClient++.cpp:537: Injected Performance Result: ''

It seems that the values of the parameters are passed to NSClient, but not injected!

Any Ideas? Thanks in advance.

  • Message #918

    Did you ever figure this one out?

    Isn't the argument passing case-sensitive like documented here CheckExternalScripts

  • Message #922

    I'm having the same problem is this a bug?

    • Message #937

      It should be $ARG1$ not $arg1$...

      MickeM

      • Message #938

        Thats what i'm using in the NSC.ini

        alias_cpu=checkCPU warn=$ARG1$ crit=90 time=5m time=1m time=30s
        

        This is the check_nrpe command i'm using

        $USER1$/check_nrpe -t 60 -H $HOSTADDRESS$ -c alias_cpu -a 20
        

        The output of the check_nrpe command is

        check_nrpe -t 60 -H 10.40.2.133 -c alias_cpu -a 20
        WARNING: 5m: average load 0% > warning, 1m: average load 0% > warning, 30s: average load 0% > warning|'5m'=0%;0;90; '1m'=0%;0;90; '30s'=0%;0;90; - nagios
        

Subscriptions