NCPA - execute custom (.bat) script with parameters

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
tmoensted
Posts: 2
Joined: Tue Mar 05, 2013 4:28 am

NCPA - execute custom (.bat) script with parameters

Post by tmoensted »

Hi guys

I am trying the following:
Execute a .bat file (check_windows_time.bat - http://exchange.nagios.org/directory/Pl ... t)/details) on a Windows 7 machine running NCPA using check_ncpa.py from my Nagios XI server.

On the windows machine, i have placed the .bat file in the plugins folder of NCPA, and i have tried adding ".bat = $plugin_name $plugin_args" as well as ".bat = cmd /c $plugin_name $plugin_args" to ncpa.cfg.
Before i added the "$plugin_args" i was able to call the script just fine like this:
./check_ncpa.py -H 10.15.150.16 -t Evenex -P 5693 -M agent/plugin/check_windows_time.bat

however - i need to pass several parameters to the script; so after changing:
.bat = cmd /c $plugin_name
to
.bat = cmd /c $plugin_name $plugin_args

i tried again.
Now, no matter how many parameters i specify, the script always seems to be called with the word "None":

call:
[root@admNAG001 libexec]# ./check_ncpa.py -H 10.15.150.16 -t Evenex -P 5693 -M agent/plugin/check_windows_time.bat -a 10.15.81.250
UNKNOWN: Lookup failure for host None

(debug) log on NCPA:
INFO:werkzeug:10.15.81.232 - - [16/Oct/2013 13:53:29] "GET /api/agent/plugin/check_windows_time.bat?token=Evenex&check=1&arguments=10.15.81.250 HTTP/1.0" 301 -
DEBUG:root:Executing the plugin with instruction contained in config. Instruction is: $plugin_name $plugin_args
DEBUG:root:Running process with command line: ['C:\\Program Files (x86)\\Nagios\\NCPA\\plugins/check_windows_time.bat', 'None']
INFO:werkzeug:10.15.81.232 - - [16/Oct/2013 13:53:32] "GET /api/agent/plugin/check_windows_time.bat/?token=Evenex&check=1&arguments=10.15.81.250 HTTP/1.0" 200 -


I am confused, because NCPA seems to receive the parameter (GET /api/agent/plugin/check_windows_time.bat?token=Evenex&check=1&arguments=10.15.81.250 HTTP/1.0) but
the script gets called like this: C:\\Program Files (x86)\\Nagios\\NCPA\\plugins/check_windows_time.bat', 'None'

Where does that "None" come from - am i totally missing something here?
Any help would be appreciated

Best regards
Theis
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: NCPA - execute custom (.bat) script with parameters

Post by sreinhardt »

I can't say I have yet to use the arguments functionality. However I am implementing some test machines internally and will give this a shot tonight or tomorrow morning and see what I can find out for you!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
mprentice
Posts: 1
Joined: Thu Oct 17, 2013 4:01 am

Re: NCPA - execute custom (.bat) script with parameters

Post by mprentice »

Love the new app! I have a similar problem with the defined powershell Plugin Directive. I had to change it to the following in order for it to work. Note all the additions and the lack of the $plugin_args

powershell -ExecutionPolicy Unrestricted -NoProfile -NoLogo -NonInteractive -File $plugin_name
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: NCPA - execute custom (.bat) script with parameters

Post by sreinhardt »

Glad you like it! Interesting notes on the powershell flags!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
tmoensted
Posts: 2
Joined: Tue Mar 05, 2013 4:28 am

Re: NCPA - execute custom (.bat) script with parameters

Post by tmoensted »

I am wondering if any work is ongoing on this - i primarily look forward to switching to NCPA because the limits NRPE imposed on the amount of data that can be returned to Nagios annoys me - but before i can even test NCPA i need to be able to run custom scripts with custom parameters.

Best regards
Theis
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NCPA - execute custom (.bat) script with parameters

Post by slansing »

NCPA is constantly being developed on so you can expect releases in the future, at the time being we do not have a timeline for releases.
Locked