NCPA calling batch file with arguments ---- Help !

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
browners80
Posts: 6
Joined: Wed Nov 15, 2017 6:51 am

NCPA calling batch file with arguments ---- Help !

Post by browners80 »

Hello,

I am quite new to Nagios and have reached the stage where I need to call external batch files which include argument. I have tested this using nrpe and it is successful although would like to use NCPA.


I have move the batch file 'check_windows_time.bat' to the /plugins directory.

From the windows server plugins directory using cli I run the batch file successfully using - the args after the.bat are ntp source and offset
check_windows_time 10.0.0.1 30 10 and receive the correct output -
OK: Time is+00.0250767s from 10.0.0.1:'Offset'=00s;30;10;0

How do I call this from the Nagios box using check_ncpa.py

from /usr/local/libexec

./check_ncpa.py -v -H 10.0.0.100 -t MyToken -P 5693 -M 'plugins/check_windows_time.bat' ???????
kyang

Re: NCPA calling batch file with arguments ---- Help !

Post by kyang »

What version of NCPA do you have?

I'm using the latest version 2.1.1 and check_ncpa.py version 1.1.2 (we are on 1.1.3 now)

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -V
You would have to make sure the bat file is /plugins directory of your windows machine.

Code: Select all

C:\Program Files (x86)\Nagios\NCPA\plugins\check_windows_time.bat
Is where I put mine in, it's likely the same for you.

After that, I ran my check like this from my XI server. (192.168.3.242 is my windows machine)

Code: Select all

[root@localhost plugins]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.3.242 -t 'mytoken1' -P 5693 -M 'plugins/check_windows_time.bat' -a 'pool.ntp.org 30 10'
OK: Time is +00.0254118s from pool.ntp.org|'Offset'=00s;30;10;0
I hope this helps!
browners80
Posts: 6
Joined: Wed Nov 15, 2017 6:51 am

Re: NCPA calling batch file with arguments ---- Help !

Post by browners80 »

Many thanks for your reply. I just needed to figure out the correct syntax for passing the args. It worked perfectly.

Thankyou.
kyang

Re: NCPA calling batch file with arguments ---- Help !

Post by kyang »

Sounds good!

Are we okay to lock this thread?
browners80
Posts: 6
Joined: Wed Nov 15, 2017 6:51 am

Re: NCPA calling batch file with arguments ---- Help !

Post by browners80 »

Yes ok to lock
kyang

Re: NCPA calling batch file with arguments ---- Help !

Post by kyang »

Sounds good! I'll be closing this thread!

If you have any more questions, feel free to create another thread.

Thanks for using the Nagios Support Forum!
Locked