A selected server will be indicated by *
. But how much time will this take to select a peer from the pool if ntp service is restarted?
I'm trying to monitoring NTP server offset but every time i restart the service the selection process takes a while and wanted to know how long it'd take.
~$ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*time4.stupi.se .PPS. 1 u 2 128 377 7.796 16.636 4.146
+213-21-116-142. 192.36.144.22 2 u 18 64 377 8.261 17.013 3.807
+ntp.xpd.se 192.36.144.22 2 u 38 64 377 8.855 20.929 2.537
+mail.joacimmeli 192.36.144.22 2 u 28 64 377 9.228 19.509 25.804
+juniperberry.ca 193.79.237.14 2 u 26 64 377 44.612 19.835 2.443
~$
According to the NTP docs, it takes a minimum of 6 polls to achieve synchronization. With pools, the recommended way to achieve this is by use of the
iburst
option on thepool
directive, e.g.By using
iburst
, you should achieve synchronization with the first contact of the pool hosts. This should take no more than a few seconds (depending on your upstream bandwidth), so 10 minutes seems a reasonable cutoff for lack of synchronization.Normally,
ntpd
will select a few hosts from each pool defined in the configuration, then discard the less accurate peers over time, settling on the best hosts after a few polls - usually it's 4 hosts, but that's just my observation and isn't documented behaviour, as far as I know.If you have operational requirements for NTP monitoring, you might want to consider using an existing monitoring solution rather than a home-grown one. I wrote an overview of NTP alerting & telemetry solutions a few years ago which might be helpful.