Page 1 of 1

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

Posted: Thu Feb 15, 2018 7:28 am
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' ???????

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

Posted: Thu Feb 15, 2018 2:58 pm
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!

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

Posted: Thu Feb 15, 2018 6:31 pm
by browners80
Many thanks for your reply. I just needed to figure out the correct syntax for passing the args. It worked perfectly.

Thankyou.

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

Posted: Fri Feb 16, 2018 10:04 am
by kyang
Sounds good!

Are we okay to lock this thread?

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

Posted: Wed Feb 21, 2018 10:36 am
by browners80
Yes ok to lock

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

Posted: Wed Feb 21, 2018 10:58 am
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!