Page 1 of 1

Vbscript Help

Posted: Thu Dec 20, 2012 9:54 am
by ryan_breneman
I'm hoping someone can help me with this. I found this script on the nagios exchange (http://exchange.nagios.org/directory/Pl ... ck/details) and it works great when I run the vbscript locally on the client.

I would like to run this as a service check ($USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c check_ad $ARG1$).
I added the following line to nsclient.ini under the /settings/external scripts/scripts section: check_ad=cscript scripts\check_ad.vbs //nologo /test:$ARG1$

On the client the command that should run is: cscript check_ad.vbs //nologo /test:replications. Again, this works fine if I run locally from the client cmd prompt. When I run a test from the service screen this is what I get:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H IPADDRESS -t 30 -c check_ad replications
OUTPUT: CRITICAL - $ARG1$: CRITICAL.

I have a feeling I'm missing something in the nsclient.ini file, but I'm not sure what. All the documentation I find online refers to a nsc.ini file which I don't have.
Thanks!
Ryan

Re: Vbscript Help

Posted: Thu Dec 20, 2012 10:36 am
by scottwilkerson
try

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H IPADDRESS -t 30 -c check_ad -a "replications"

Re: Vbscript Help

Posted: Thu Dec 20, 2012 10:41 am
by ryan_breneman
Didn't work, got the same response back:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.42.1.2 -t 30 -c check_ad -a "replications"
OUTPUT: CRITICAL - $ARG1$: CRITICAL.

Re: Vbscript Help

Posted: Thu Dec 20, 2012 10:45 am
by scottwilkerson
In the NSC.ini do you have?

Code: Select all

allow_arguments=1
Also, in most cases you would put the //NoLogo after cscript, not after the script name

ie

Code: Select all

check_ad=cscript.exe //NoLogo scripts\check_ad.vbs /test:$ARG1$

Re: Vbscript Help

Posted: Thu Dec 20, 2012 10:52 am
by ryan_breneman
Thanks Scott, that was it! FYI...I didn't have a NSC.ini file, I have nsclient.ini, and the line was allow arguments = false. I changed that to true and it worked!

Now I'm getting the following:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H IPADDRESS -t 30 -c check_ad -a "replications"
OUTPUT: OK - replications: OK.

Thanks so much for your help, I really appreciate it!