[ntp:questions] Extracting ntpq like information programmatically
unruh at invalid.ca
Fri Mar 29 17:20:50 UTC 2013
On 2013-03-29, Claudio Carbone <erupter at libero.it> wrote:
> On 29/03/13 16:59, unruh wrote:
>> I have no idea what you want to do-- your description just left me
>> confused, but perhaps the above may allow you to decide if the ntp
>> protocol might be useful to you.
> I have a network of machines with a master server which is the only one
> connected to the internet.
> This internet connection is not shared by the other machines.
> Each machine uses ntpd to sync with the master server.
> The master server runs an ntpd to provide time information for the
> sub-network, and to sync with the worldwide network.
> I assume clocks are synchronized by the NTP daemon.
Are they synchronized? If they are running ntpd then that is presumably
what synchronizes them.
> The machines exchange packets and do work, and I want to meter the
> delays in message passing and work execution in varying network load
> To do this ideally I should have a single clock, but that is plainly
That is what synchronization is all about. It means that they all share
the same time to some accuracy. On a local network, ntpd can synchronize
to tens of microseconds.
"Exchange packets and do work" is pretty vague. I assume you do not mean
"exchange ntp packets and synchronize their clocks" but are perhaps
using some sort of database etc
> So the next best thing is to use the single machines kernel clocks
> corrected with the NTP data.
> But to do this I need to periodically save NTP offset and jitter data
> (delay seems irrelevant).
Why? ntpd synchronizes the clocks to the best way possible If it were
possible to do a better job it should do so (of course there are
arguments that it does not do the best possible job, but then that
depends on one's definition of best, etc). Ie, the clocks time is about
as good an estimate of the real time (UTC) as you will get from those
offsets jitter and delays. Note that ntpd already saves this
information in the various log files. Make sure you enable them in your
enables the peerstats and loopstats information in /var/log/ntp/
>> Since almost all of ntp is concerned with what to do with that
>> information of the offset and delay once it has been received, almost
>> everything in libntp or in ntpd is completely irrelevant to you and is
>> just a waste of memory.
> This is not clear to me.
Neither is what you want to do to me.
More information about the questions