NTP Check on Windows Servers with NCPA agents

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
imadc
Posts: 58
Joined: Wed Jun 14, 2017 12:10 pm

Re: NTP Check on Windows Servers with NCPA agents

Post 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]#
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NTP Check on Windows Servers with NCPA agents

Post 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
You 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!
imadc
Posts: 58
Joined: Wed Jun 14, 2017 12:10 pm

Re: NTP Check on Windows Servers with NCPA agents

Post 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]#
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NTP Check on Windows Servers with NCPA agents

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
imadc
Posts: 58
Joined: Wed Jun 14, 2017 12:10 pm

Re: NTP Check on Windows Servers with NCPA agents

Post 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 ?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NTP Check on Windows Servers with NCPA agents

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked