Search This Blog


Debugging NTPd

Getting an alert where ntp was out of sync?

There are a couple tools you can use to validate whether ntp is functioning normally.

First is ntpstat, which will show you which ntp server the device is currently synchronized with:
synchronised to NTP server ( at stratum 3
   time correct to within 1945 ms
   polling server every 1024 s

In the above we can see that this server is actually in sync, but only in sync within 1945ms which is about 2 seconds. This seems a bit long to me and since we were getting an alert I decided to see if the server was actually accessible.

After a ping, it looks like I was unable to access it.

Tried manually syncging with ntpdate -q and it was unable to perform the task
ntpdate -q
server, stratum 0, offset 0.000000, delay 0.00000
12 Feb 11:22:12 ntpdate[15082]: no server suitable for synchronization found

I restarted ntpd:
service ntpd restart

It looked like it had a new set of peers, but was still unsynchronized:
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
 penguin.hopcoun     2 u   44   64    1   10.000    0.369   0.000
 ks4001083.ip-19      2 u   43   64    1   13.813    0.007   0.000
 time1.srv.ualbe .GPS.            1 u   44   64    1  147.417  -48.701   0.000

# ntpstat
  time server re-starting
   polling server every 64 s

After a while though it eventually synched and everything was fine
# ntpstat
synchronised to NTP server ( at stratum 2
   time correct to within 60 ms
   polling server every 256 s

In redhat you can also configure additional logging by adding the -l $dir in /etc/sysconfig/ntpd and restarting the service.


No comments:

Post a Comment