Page 1 of 3

Requesting Help Configuring check_ntp_time

Posted: Fri Mar 06, 2015 10:33 am
by rockxd
I am interesting comparing the time on the Nagios host and a NTP server. I understand how to write the definitions within the configuration files, but I do not now much about NPT servers.

Are there public NTP servers that I can access (and where can I find the credentials like ip address/host name of the public server)?

Also I am currently hosting my Nagios on a RHEL machine, but in the future I will be switching the host to a mac mini. Will there be any changes I will have to make to the definitions or configurations if I make this change?

Re: Requesting Help Configuring check_ntp_time

Posted: Fri Mar 06, 2015 11:09 am
by jdalrymple
Welcome back rockxd,

there are lots of public NTP servers in a pool. I suggest you read up here:

http://www.pool.ntp.org/en/

The question going forward - now that you have all of your servers using time protocol to compare remote time to Nagios server time, do you want to deploy that check to all of your remote servers or are you just hoping to verify the time of your Nagios server. Verifying the time of your Nagios server is trivial. You just setup a command definition and service for your localhost using the check_ntp plugin.

add to commands.cfg:

Code: Select all

define command{
        command_name    check_ntp
        command_line    $USER1$/check_ntp $ARG1$
        }
add to localhost.cfg:

Code: Select all

define service {
        host_name                       localhost
        service_description             NTP
        check_command                   check_ntp!-H pool.ntp.org
        use                             generic-service
        }
It should be just that easy.

Re: Requesting Help Configuring check_ntp_time

Posted: Fri Mar 06, 2015 11:12 am
by tmcdonald
As for the configs, nothing should need to change in terms of changing things like "service_description" if that's what you mean.

Re: Requesting Help Configuring check_ntp_time

Posted: Fri Mar 13, 2015 1:29 pm
by rockxd
All I want is to check my Nagios host with the NTP server. I used the configuration you suggested, but i get a CRITICAL message of "No response from NTP server "

Re: Requesting Help Configuring check_ntp_time

Posted: Fri Mar 13, 2015 1:42 pm
by jdalrymple
Possibly a connection issue?

Code: Select all

[jdalrymple@localhost libexec]$ sudo ntpdate -v pool.ntp.org
13 Mar 13:41:53 ntpdate[94765]: ntpdate [email protected] Sat Dec 20 02:53:40 UTC 2014 (1)
13 Mar 13:41:54 ntpdate[94765]: adjust time server 97.107.129.217 offset 0.001322 sec

Re: Requesting Help Configuring check_ntp_time

Posted: Fri Mar 13, 2015 2:08 pm
by rockxd
I get the following:

Re: Requesting Help Configuring check_ntp_time

Posted: Fri Mar 13, 2015 2:19 pm
by jdalrymple
This just means that NTP is functioning on that server, which is good :)

Code: Select all

[jdalrymple@localhost libexec]$ sudo /etc/init.d/ntpd stop
Shutting down ntpd:                                        [  OK  ]
[jdalrymple@localhost libexec]$ sudo ntpdate -v pool.ntp.org
13 Mar 14:18:28 ntpdate[105149]: ntpdate [email protected] Sat Dec 20 02:53:40 UTC 2014 (1)
13 Mar 14:18:29 ntpdate[105149]: adjust time server 199.102.46.76 offset 0.001079 sec
[jdalrymple@localhost libexec]$ sudo /etc/init.d/ntpd start
Starting ntpd:                                             [  OK  ]

Re: Requesting Help Configuring check_ntp_time

Posted: Mon Mar 23, 2015 3:07 pm
by rockxd
It is saying that my server is not suitable for synchronization.

Re: Requesting Help Configuring check_ntp_time

Posted: Mon Mar 23, 2015 3:23 pm
by jdalrymple
Can you ping pool.ntp.org?

Usually that message means either the ntp server is unreachable, or your clock skew is too great to correct it.

It might also be worthwhile to checkout your ntp.conf and make sure we even have some servers configured:

Code: Select all

[jdalrymple@localhost ~]$ sudo grep ^server /etc/ntp.conf
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

Re: Requesting Help Configuring check_ntp_time

Posted: Mon Mar 23, 2015 3:32 pm
by rockxd
Those servers are not in the configuration, should I add them?