Page 1 of 1
Plugin check_ntp_peer Return code of 126 is out of bounds
Posted: Fri May 29, 2015 10:08 am
by intern_nagios
Hi there,
I'm trying to check the NTP status and offset of my NTP servers in Nagios. When I manually ran the command, I did get the result I was looking for:
Code: Select all
./check_ntp_peer -H **** -w .5 -c 1
NTP OK: Offset 0.001174 secs|offset=0.001174s;0.500000;1.000000;
As soon I configured Nagios to ran the plugin I received the "(Return code of 126 is out of bounds - plugin may not be executable)" error.
- the plugin does have the following rights: -rwxr-xr-x. 1 nagios nagios 172921 May 13 14:59 check_ntp_peer
I'll show the command definition:
Commands.cfg
Code: Select all
define command{
command_name check_ntp
command_line /usr/local/nagios/libexec/check_ntp_peer -H $HOSTADDRESS$ -w .5 -c 1
}
The most of my plugins are installed at /usr/lib64/nagios/plugins so that's where $USER1$ is pointing at. I did create a $USER2$ to /usr/local/nagios/libexec but that did not work either.
Do you guys know what I did wrong? Thanks in advance.
Re: Plugin check_ntp_peer Return code of 126 is out of bound
Posted: Fri May 29, 2015 10:56 am
by tmcdonald
When running it from the CLI, are you running it as root or as nagios? Make sure the nagios user is used for testing, since that is what will ultimately end up being used.
Re: Plugin check_ntp_peer Return code of 126 is out of bound
Posted: Fri May 29, 2015 3:25 pm
by intern_nagios
Thanks. I tried the following and I guess you were right.
Code: Select all
#runuser -l nagios /usr/local/nagios/libexec/check_ntp_peer
/usr/local/nagios/libexec/check_ntp_peer: /usr/local/nagios/libexec/check_ntp_peer: cannot execute binary file
To make sure I did use the correct command, I check also if I can run with root, as in
Code: Select all
runuser -l nagios /usr/local/nagios/libexec/check_ntp_peer
Unfortunately, that did not work either.
So, I checked the permissions and saw the following:
Code: Select all
#ll | grep ntp_peer
-rwxr-xr-x. 1 nagios nagios 172921 May 13 14:59 check_ntp_peer
I think I use the wrong file or something like that? Does anyone have a clue?
Re: Plugin check_ntp_peer Return code of 126 is out of bound
Posted: Mon Jun 01, 2015 9:23 am
by tgriep
A couple of things you can do.
You can move the plugin check_ntp_peer to your other folder /usr/lib64/nagios/plugins and run it from there.
Or you will need to make sure the nagios user has the permissions setup correctly on the folders /usr/local/nagios and /use/local/nagios/libexec
Re: Plugin check_ntp_peer Return code of 126 is out of bound
Posted: Mon Jun 01, 2015 10:11 am
by intern_nagios
Hi tgriep,
Thanks for the help.
I already tried your first suggestion, to move/copy the check_ntp_peer file to the /usr/lib64/nagios/plugins/ folder, no succes, same error.
I'll check and compare the permissions on the folders and change them if there are differences. Keep you posted after that.
Thanks!
Re: Plugin check_ntp_peer Return code of 126 is out of bound
Posted: Mon Jun 01, 2015 11:46 am
by tgriep
Another thing to try is to set both the owner and group to root of the check_ntp_peer check.
Re: Plugin check_ntp_peer Return code of 126 is out of bound
Posted: Wed Jun 03, 2015 3:40 am
by intern_nagios
I solved the problem, I used the restorecon command and after that the plugin worked immediately.
Thanks guys!
Re: Plugin check_ntp_peer Return code of 126 is out of bound
Posted: Wed Jun 03, 2015 9:12 am
by tmcdonald
I'll be closing this thread now, but feel free to open another if you need anything in the future!