[ntp:questions] deterministic failure detection

Charles Elliott elliott.ch at verizon.net
Sat Jun 25 14:05:30 UTC 2011

A crummy, but easy and feasible way to do it would be to write a script or
Java, C++, C#, etc. program to:

invoke ntpq.exe connecting stdin and stdout to the program
send each computer name to ntpq via stdin
send each computer the "peers" command via stdin to ntpq
collect the output from ntpq via stdout; it will look like

ntpq> peers
     remote           refid      st t when poll reach   delay   offset
+ntp1.conectiv.c .IRIG.           1 u    5   32  377   40.006   -1.953
*clock.nyc.he.ne .CDMA.           1 u    8   32  377   38.401   -2.503
 LOCAL(0)        .LOCL.           0 l   14   16  377    0.000    0.000

Parse the output for the info you need, where '*' means the computer is
synched to that host.

A better way would be to figure out how ntpq operates, and copy that.  The
source for ntpq is in the X:\NTP-Source\ntp-4.2.6p3\ntpq directory if you
download the latest source from www.ntp.org and unzip it to NTP-Source.  The
documentation for ntpq, which explains the above output, is in the
C:\Program Files (x86)\NTP\doc\HTML directory or equivalent.  You could
probably also use ntpdc using the same scheme as above.

Charles Elliott

> -----Original Message-----
> From: questions-bounces+elliott.ch=verizon.net at lists.ntp.org
> [mailto:questions-bounces+elliott.ch=verizon.net at lists.ntp.org] On
> Behalf Of pilotgeek
> Sent: Friday, June 24, 2011 7:02 PM
> To: questions at lists.ntp.org
> Subject: [ntp:questions] deterministic failure detection
> Hello,
> I have an application which uses NTP for clock synch.  Each network
> upon which this application runs has one or more IRIG-B Stratum 1 NTP
> servers (embedded, not ntpd).  The remaining hosts on the network are
> synch'd directly to those stratum 1 servers.  All of those hosts are
> Windows 7 running ntpd 4.2.6 p3.
> I would like to be able to predictably have the Windows clients
> indicate out of synch if they poll and are unable to connect to any of
> the servers.  Given a network of clients that are up for 10 hrs or so
> (so their confidence in the servers if high) I am getting varying
> results.  Some indicate unreachable and drop the asterisk from the
> tally code.  Others still stay in sys.peer seemingly indefinitely.  I
> am puzzled as to why this would be the case.
> So the question is:  Is there a way to have a running (and currently
> synchronized) ntpd client stop indicating synch when it can not poll
> any of its servers?
> Thanks in advance for any ideas.
> Regards,
> Neal
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions

More information about the questions mailing list