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]#
NTP Check on Windows Servers with NCPA agents
Re: NTP Check on Windows Servers with NCPA agents
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:
Next, run the following commands from the command line, and show the output:
Download the two files below, remove the *.txt extension, and place them in the NCPA plugins folder:
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' -vYou do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: NTP Check on Windows Servers with NCPA agents
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]#
[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
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.
Here's what I see when I test the same bat file:[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.
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.[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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: NTP Check on Windows Servers with NCPA agents
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 ?
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
Sure - let us know what you found out.Let me ask them if any GPO related blocking this
Honestly, I don't know. There are a couple of things that we need to check though.question is there a wait to run the bat as administrator maybe that will force the arguments ?
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.
Be sure to check out our Knowledgebase for helpful articles and solutions!