NCPA - execute custom (.bat) script with parameters
Posted: Wed Oct 16, 2013 6:55 am
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
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