Page 2 of 2
Re: NTP Check on Windows Servers with NCPA agents
Posted: Tue Mar 10, 2020 11:42 am
by imadc
Yes same output,
[root@rdnagios libexec]# ./check_ncpa.py -H X>X>X>X -t XYZ -M 'plugins/check_windows_time.bat' -q 'args=pool.ntp.org,args=120,args=300'
"C:\Program Files (x86)\Nagios\NCPA\plugins\check_windows_time.bat" - Nagios plugin that checks time offset against a specified ntp server.
Usage: "C:\Program Files (x86)\Nagios\NCPA\plugins\check_windows_time.bat" <timeserver> <warning threshold in seconds> <critical threshold in seconds>
Examples: "C:\Program Files (x86)\Nagios\NCPA\plugins\check_windows_time.bat" pool.ntp.org 120 300
"C:\Program Files (x86)\Nagios\NCPA\plugins\check_windows_time.bat" my-domain-controller.local 120 300
[root@rdnagios libexec]#
Re: NTP Check on Windows Servers with NCPA agents
Posted: Tue Mar 10, 2020 12:31 pm
by lmiltchev
Let's check if you can call other *.bat files via check_ncpa.py, and if you can pass parameters to your command.
Download the two files below, remove the *.txt extension, and place them in the NCPA plugins folder:
hello1.bat.txt
hello2.bat.txt
Next, run the following commands from the command line, and show the output:
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'token' -M 'plugins/hello1.bat' -q 'args=Hello,args= World' -v
/usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'token' -M 'plugins/hello2.bat' -v
Re: NTP Check on Windows Servers with NCPA agents
Posted: Tue Mar 10, 2020 12:47 pm
by imadc
Both worked. CHeck below -
[root@rdnagios libexec]# ./check_ncpa.py -H XXX -t XYZ -M 'plugins/hello1.bat' -q 'args=Hello,args= World' -v
Connecting to:
https://10.90.112.22:5693/api/plugins/h ... rgs=+World
File returned contained:
{
"returncode": 0,
"stdout": "ECHO is off."
}
ECHO is off.
[root@rdnagios libexec]# ./check_ncpa.py -H XXX -t XYZ -M 'plugins/hello2.bat' -v
Connecting to:
https://10.90.112.22:5693/api/plugins/h ... Pa&check=1
File returned contained:
{
"returncode": 0,
"stdout": "Hello World"
}
Hello World
[root@rdnagios libexec]#
Re: NTP Check on Windows Servers with NCPA agents
Posted: Tue Mar 10, 2020 1:39 pm
by lmiltchev
I don't think the check with args ran successfully, even though the return code is 0... I don't see "Hello World" in the output.
[root@rdnagios libexec]# ./check_ncpa.py -H XXX -t XYZ -M 'plugins/hello1.bat' -q 'args=Hello,args= World' -v
Connecting to:
https://10.90.112.22:5693/api/plugins/h ... rgs=+World
File returned contained:
{
"returncode": 0,
"stdout": "ECHO is off."
}
ECHO is off.
Here's what I see when I test the same bat file:
[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.x.x -t 'mytoken' -M 'plugins/hello1.bat' -q 'args=Hello,args= World' -v
Connecting to:
https://192.168.x.x:5693/api/plugins/he ... rgs=+World
File returned contained:
{
"returncode": 0,
"stdout": "Hello World"
}
Hello World
I am not sure if you have something in your group policy that prevents you from passing parameters to batch scripts. Please ask your system administrator if there is such a limitation in your environment.
Re: NTP Check on Windows Servers with NCPA agents
Posted: Thu Mar 12, 2020 10:45 am
by imadc
Let me ask them if any GPO related blocking this
question is there a wait to run the bat as administrator maybe that will force the arguments ?
Re: NTP Check on Windows Servers with NCPA agents
Posted: Thu Mar 12, 2020 11:33 am
by lmiltchev
Let me ask them if any GPO related blocking this
Sure - let us know what you found out.
question is there a wait to run the bat as administrator maybe that will force the arguments ?
Honestly, I don't know. There are a couple of things that we need to check though.
1. Is NCPA Listener service running as "system" or as some other account on that machine?
2. Have you modified any of the permissions on the NCPA plugins folder from the "defaults"?
I was going to escalate the issue to our NCPA developer, but he is off this week, and will be back on Monday. Meanwhile, you can post the issue on GitHub here:
https://github.com/NagiosEnterprises/ncpa/issues
This way, you could communicate with our developers directly, and possibly receive a response before Monday.