The command (check_time) returned an invalid return code:128

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

The command (check_time) returned an invalid return code:128

Post by grayloglearn »

Hi Team,

While we are checking the time syn we are getting the return code 128. Please find the below and help us why we are getting 128 error.

root@nagih libexec]# ./check_nrpe -H XXXX -c check_time -a ntp.test.com 5 20
The command (check_time) returned an invalid return code: 128

we are able to telnet 5666 port to remote server.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: The command (check_time) returned an invalid return code

Post by lmiltchev »

Does the command work when you run it locally on the client (remote machine)?

Code: Select all

./check_time -H ntp.test.com -w 5 -c 20
Can you show us how the check_time command is defined on the client?

I tried the following setup, which worked for me:

In nrpe.cfg on the remote machine:

Code: Select all

command[check_time]=/usr/local/nagios/libexec/check_time -H $ARG1$ -w $ARG2$ -c $ARG3$
From the Nagios XI server:

Code: Select all

[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_time -a time.nist.gov 5 20
TIME OK - 0 second time difference|time=0s;;;0 offset=0s;5;20;0
Be sure to check out our Knowledgebase for helpful articles and solutions!
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

Re: The command (check_time) returned an invalid return code

Post by grayloglearn »

Please find the below details which we added in nsclient.ini and Please tell us why we get 128 return code. Please don't send link for return code actually i am not understanding. If we get this type of messages 128 what we need to do from client end.

nsclient.ini config below

; WRAPPED SCRIPT - A wrapped script defenitions
[/settings/external scripts/wrapped scripts]
check_time = fair\\check_time.vbs %ARGS%



Command in nagios-server:
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 120 -c $ARG1$ $ARG2$ $ARG3$

/usr/local/nagios/libexec/check_nrpe -H XXX -t 120 -c check_time -a ntp.test.com 5 20
The command (check_time) returned an invalid return code: 128

But we are getting the output for some other server
/usr/local/nagios/libexec/check_nrpe -H XXXX-t 120 -c check_time -a ntp.test.com 5 20
NTP OK: Offset -0.7279992 secs|'offset'=-0.72799s;5;20
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: The command (check_time) returned an invalid return code

Post by lmiltchev »

So, I didn't realize that you are using NSClient++... This would be a bit different, but we can make it work.

1. Can you confirm that you are using the plugin below?
https://exchange.nagios.org/directory/U ... s)/details

2. If you are using it, then you would need to set it up differently. Place the plugin in the NSClient++ scripts directory. Remove the line that you have under the [/settings/external scripts/wrapped scripts] section.

Code: Select all

check_time = fair\\check_time.vbs %ARGS%
Add the following line under the [/settings/external scripts/scripts] section:

Code: Select all

check_time = cscript.exe //T:30 //NoLogo scripts\check_time.vbs $ARG1$
Save, exit, and restart NSClient++ service, so that changes can take effect. Test your check from the command line.

Example:

Code: Select all

[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_time -a 'pool.ntp.org,time.nist.gov 2 5'
NTP OK: Offset +0.2097703 secs|'offset'=0.20977s;2;5
3. If you are NOT using this plugin, but some other, "custom" one, please upload it on the forum, so that we can test it in-house.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked