NSClient++ Help (#1) - ExternalScript? arguments (#128) - Message List
The External Script module seems really good -- I'm trying to use arguments with a VBScript (it works when run locally) but not having much luck.
The NSC.ini file has it set as: check_backup=cscript.exe NoLogo scripts\checkBackup.vbs
I run it from the Nagios box command line as: ./check_nrpe -H 123.456.789.100 -p 1234 -c CHECK_BACKUP -a theArgument
The Nagios commands config has NRPE defined as: command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 1234 -c $ARG1$ -a $ARG2$
And finally the service definition is: check_command check_nrpe!CHECK_BACKUP!theArgument
The VBScript runs perfectly fine, but using the defaults and not the argument I am trying to pass. I've tried with the CHECKEVENTLOG function as well, it works fine from the command line (using passed in arguments) but won't work using a service definition of:
check_command check_nrpe!CHECKEVENTLOG!filter=in file=system filter-generated=\<8h unique
How do I get the arguments to pass correctly in both of these instances? And also, what must I return (using WScript.Quit) as Critical, Warning, Unknown, etc. OK is obviously 0.
-
Message #335
For passing arguments along there s a bunch of allow arguments and allow nasty arguments option you can set. be aware though that the nasty option is a security risk as it will allow injection and such so take care with those options.
MickeM
mickem04/15/08 08:40:15 (5 years ago)-
Message #336
Thanks for the quick reply MickeM, I've set both of those two options on and not particularly worried about the nasty arguments/injection as both NSCP and the local software firewalls only allow incoming connections from the local Nagios server; here's my NSC.ini:
[modules] FileLogger.dll CheckSystem.dll CheckDisk.dll NSClientListener.dll NRPEListener.dll SysTray.dll CheckEventLog.dll CheckExternalScripts.dll [Settings] allowed_hosts=123.456.789.100 use_file=1 [NSClient] allowed_hosts=123.456.789.100 port=12489 [NRPE] port=5666 command_timeout=60 allow_nasty_meta_chars=1 allow_arguments=1 allowed_hosts=123.456.789.100 [External Script] command_timeout=60 allow_arguments=1 [External Scripts] check_firewall=cscript.exe //NoLogo scripts\firewallState.vbs check_backup=cscript.exe //NoLogo scripts\checkBackup.vbs [External Alias]
anonymous04/15/08 09:01:04 (5 years ago)-
Message #337
... I'm not really sure why that looked so messy. Still unsure how to accept arguments (with NSCP) and pass them on (with Nagios commands / service definitions).
anonymous04/15/08 09:02:33 (5 years ago) -
Message #338
What you need to do is:
[External Scripts] check_firewall=cscript.exe //NoLogo scripts\firewallState.vbs $arg1$ $arg2$ $arg3$ check_backup=cscript.exe //NoLogo scripts\checkBackup.vbs $arg1$ $arg2$ $arg3$
IIRC.
MickeM
(and the messyness is that this is not text but "wiki text" (structured text) so you need to format it, readup on formatting in trac and you will see you can add { { { in between } } } to make "code" nice...
MickeM
mickem04/15/08 09:06:28 (5 years ago)-
Message #341
I did try that previously, but I'd only tried in upper case. I just tried putting it in lowercase, but it still only returns "$arg1$" instead of the actual argument.
I'm now getting another weird problem which I'll detail in another thread but that's on a different machine and unrelated.
anonymous04/16/08 01:42:19 (5 years ago)-
Message #342
Actually, the latest nightly seems to have fixed this problem. The latest stable is the one I was using.
anonymous04/16/08 01:43:54 (5 years ago)-
Message #1132
The arguments for external scripts have been changed to $ARG1$ $ARG2$ ... etc. (note that they are now UPPERCASE - lowercase doesn't work).
When you have a variable number of arguments it would be nice is NSCP didn't pass the $ARGx$as an argument (ie. you have an external script setup as test=scripts\test.bat $ARG1$ $ARG2$ $ARG3$ - if you only pass two arguments to that script via check_nrpe on the server, the third argument is passed as $ARG3$ literally).
blueivy03/30/09 19:08:22 (4 years ago)
-
-
-
-
-








