[ntp:questions] No libntp.so

Steve Kostecke kostecke at ntp.org
Thu Aug 28 14:19:43 UTC 2008

On 2008-08-27, Kay Hayen <kayhayen at gmx.de> wrote:

> "Joseph Gwinn" wrote:
>>  kayhayen at gmx.de (Kay Hayen) wrote:
>>> we are implementing a NTP supervision for our ATC middleware.
>>> Initially we are doing it by repeated "ntpq" executions and textual
>>> evaluations of the results. We have had to notice that pipes are
>>> very unsuited for the task, so we really fork it and close its stdin
>>> to make it flush. It works, but it is unconvincing in performance
>>> (latency).

Why is 25ms latency for statistics collection unacceptable for a
protocol which uses polling intervals between 64 and 1024 seconds?

>> What exactly is "NTP supervision"? What problem does it solve?
> I will gladly give examples of NTP functioning perfect and it still
> being needed, bare with me if they lack in one way or the other:
> a) Suppose you have a system of 10 hosts that must have near identical
> time, even if not correct. You may be using PC hardware with
> non-optimal clocks because DEC is no more. You want to know if one
> node has an offset higher than say 200ms. Can happen, and then you
> want to know, you don't even want to start the software if e.g. right
> after boot these conditions are not already met.

By default ntpd steps the clock if the offset is greater than 128 ms.

The only time that you should see an offset of this magnitude, and the
associated clock step, is at boot time. If you are seeing repeated steps
then you have issues outside of NTP that need to be dealt with.

As far as monitoring, you can trivially use another ntpd to monitor
those 10 hosts and compare their offset to your official time sources.
This is accomplished by adding the client hosts to your monitoring ntpd
with the following ntp.conf line:

	server client_N noselect

Repeat this line for each client host. You will then be able to view an
aggregated peers billboard which shows the offset/delay/jitter to the
reference sources _and_ all of those 10 clients. If you enable
statistics collection on the monitoring ntpd you can tail the peerstats
file and monitor the client offset, etc., from there.

> b) Suppose you have 2 hosts of these 10, and they are the only ones
> with connection to an "NTP LAN". They peer the 5 or even 7 external
> NTP servers that you have. For the case that the "external" NTP
> servers with low stratum values failing, you make those 2 external
> hosts peer another, but at high stratum value. But if that has
> happenen, you want to know, because isolation from external time input
> will lead to trouble sooner or later.

You probably want to configure those 10 clients in Orphan Mode so that
they will autonomously select a leader in the event that your external
time sources are unreachable.

> c) Suppose you have bought that fine NTP clock from a fine vendor,
> but it doesn't always work reliable. Some of them behave strange. I
> have seen my share of them. I think I know of a clock that doesn't
> work correctly when there is too much traffic on the LAN, it seems
> to be able to decode only so much in a given time, then drop things.
> The NTP algorithms correctly flag that clock (I don't know as what
> exactly they did, I didn't analyse that myself), but it's certainly
> nice to see that reported on your SNMP system where something becomes
> red instead of some log file only or false results from the software.

If time is _that_ critical to your application then you need to provide
an appropriate level of redundancy to withstand failures along with a
reasonable diversity of time sources to avoid homogeneous malfunctions.
And don't overlook the SPOF.

> I think "NTP supervision" mainly has to solve the problem of not
> allowing the software to continue on system with currently bad clock
> input and interfacing in a nice way with SNMP based supervision
> systems where a technical watch operator can easily visualize the
> health status of a system and take necessary actions.

As stated before, libntp only provides a few common functions used in
a number of places in the NTP distribution. The place to look for the
monitoring implementation is the ./ntpq directory in the Distribution.

The NTP Copyright allows liberal use of the source code. See ./COPYRIGHT
or ./html/copyright.html in the Distribution for the version specific
copyright notice. The current NTP Copyright Notice is available on-line
at http://www.eecis.udel.edu/~mills/ntp/html/copyright.html.

Steve Kostecke <kostecke at ntp.org>
NTP Public Services Project - http://support.ntp.org/

More information about the questions mailing list