Page 1 of 3

Trouble With check_time command

Posted: Fri Feb 27, 2015 10:12 am
by rockxd
I am currently having trouble getting the check_time command to work correctly.
Here is what is in my configuration files…

Commands:

#'check_time' command definition
define command{
command_name check_time
command_line $USER1$/check_time -H $HOSTADDRESS$
}

Configuration for Server(s):

define service{
use local-service
hostgroup_name gsgdevops-build_agents
service_description TIME
check_command check_time
}

After all this is said and done, I am left with the following message in the web interface (see attachment).

I have scoured the internet to find out why I am getting these results, but to no avail. Some sources say that I am being denied port access due to a daemon called inetd, in which the solution would be simply changing some of the settings. However, I did not find this daemon running on any of the servers.

Does anyone have any idea of what I might be doing wrong and/or how to get the check_time command working?

Re: Trouble With check_time command

Posted: Fri Feb 27, 2015 10:25 am
by jdalrymple
check_time is used to check the TIME protocol, not NTP. Are you sure that is the protocol you wish to check, or are you trying to monitor NTP servers?

If you're trying to monitor NTP servers there is a check_ntp plugin designed just for that.

Re: Trouble With check_time command

Posted: Fri Feb 27, 2015 11:55 am
by rockxd
I am not trying to monitor NTP servers.
To my understanding, the check_time command compares the nagios host and the servers it is monitoring and check if there if the machines differ in time.

Re: Trouble With check_time command

Posted: Fri Feb 27, 2015 12:12 pm
by jdalrymple
It will, but using the time service is a bit obsolete. You can use this check to achieve that goal, however it will only tell you the time difference between the Nagios server and the remote host. It won't tell you which one is right :)

I would personally prefer the check_ntp_time run on a remote host.

If you do however want to just know the difference between the 2 hosts this check will achieve that goal. Install the time service, enable it and it should work for you.

Code: Select all

[jdalrymple@localhost libexec]$ ./check_time -H remotehost
TIME OK - 15065 second time difference|time=0s;;;0 offset=15065s;;;0

Re: Trouble With check_time command

Posted: Fri Feb 27, 2015 12:48 pm
by rockxd
Yes, I know about the NTP checks. In the end I wanted to run the check_time commands with all of the servers I was monitoring and then use NTP check with the Nagios host itself.

Is this the service you are referencing installing the following: http://www.brennan.id.au/09-Network_Time_Protocol.html

Also I do not know much about installing a NTP server, but would like to know more information.

Re: Trouble With check_time command

Posted: Fri Feb 27, 2015 1:11 pm
by jdalrymple
Is this (the host to be checked) CentOS/RHEL?

If so

Code: Select all

yum install rdate
edit /etc/xinetd.d/time-stream

Code: Select all

# This is for quick on or off of the service
        disable         = yes
to

Code: Select all

# This is for quick on or off of the service
        disable         = no

Code: Select all

service xinetd restart
If not CentOS/RHEL, what distro?

Re: Trouble With check_time command

Posted: Fri Feb 27, 2015 3:26 pm
by rockxd
Yes my distro is RHEL.

But when I do 'service xinetd restart'

I get: xinetd.d/: unrecognized service

Re: Trouble With check_time command

Posted: Mon Mar 02, 2015 9:47 am
by jdalrymple
That's bizarre.

those 2 files I mentioned were there though?

Is xinetd installed?

Code: Select all

[jdalrymple@localhost ~]$ yum list installed | grep inetd
xinetd.x86_64                        2:2.3.14-39.el6_4                 @base

Re: Trouble With check_time command

Posted: Tue Mar 03, 2015 12:56 pm
by rockxd
No, I do not belive that xinetd is installed.

Re: Trouble With check_time command

Posted: Tue Mar 03, 2015 1:07 pm
by jdalrymple
It should be trivial to install:

Code: Select all

yum -y install xinetd
I'm surprised it's not. I would have guessed it to be part of a base CentOS/RHEL install.