1

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
~$
user630702
  • 495
  • 10
  • 32
  • Your configuration doesn't appear to be using NTP pools, but rather a static list of servers. (Or it's an older version which doesn't support pools properly.) Can you clarify whether you mean NTP pools, or are just referring to the list of peers in your configuration generically as a "pool"? Including your configuration would be helpful. – Paul Gear May 02 '20 at 20:35
  • I copied that output from a site. But I'm talking about monitoring ntp server that uses pool.ntp.org. All my clients sync from that ntp server and I monitor them. But I also want to monitor the NTP Server itself just in case the ntp server is very behind also I need to configure an item to let me know if the ntpserver hasn't selected a peer within n minutes. But I just wanted to know how long it usually takes to select a peer. I've right now set it to alert me if no peer selected within 10 minutes but was also curious how long it takes since I can't find a reference to that anywhere. – user630702 May 03 '20 at 13:00
  • Although the `ntpq -p` output looks as same mine. Basically it lists a list of servers (peers) and marks with `*` for selected peer. – user630702 May 03 '20 at 15:02

1 Answers1

0

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 the pool directive, e.g.

pool pool.ntp.org iburst

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.

Paul Gear
  • 4,367
  • 19
  • 38