Requesting Help Configuring check_ntp_time

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
rockxd
Posts: 26
Joined: Fri Feb 27, 2015 10:01 am

Requesting Help Configuring check_ntp_time

Post 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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Requesting Help Configuring check_ntp_time

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Requesting Help Configuring check_ntp_time

Post 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.
Former Nagios employee
rockxd
Posts: 26
Joined: Fri Feb 27, 2015 10:01 am

Re: Requesting Help Configuring check_ntp_time

Post 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 "
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Requesting Help Configuring check_ntp_time

Post 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 4.2.6p5@1.2349-o 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
rockxd
Posts: 26
Joined: Fri Feb 27, 2015 10:01 am

Re: Requesting Help Configuring check_ntp_time

Post by rockxd »

I get the following:
Attachments
2015-03-13 03.08.23 pm.png
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Requesting Help Configuring check_ntp_time

Post 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 4.2.6p5@1.2349-o 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  ]
rockxd
Posts: 26
Joined: Fri Feb 27, 2015 10:01 am

Re: Requesting Help Configuring check_ntp_time

Post by rockxd »

It is saying that my server is not suitable for synchronization.
Attachments
New Result.png
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Requesting Help Configuring check_ntp_time

Post 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
rockxd
Posts: 26
Joined: Fri Feb 27, 2015 10:01 am

Re: Requesting Help Configuring check_ntp_time

Post by rockxd »

Those servers are not in the configuration, should I add them?
Locked