[ntp:questions] Monitoring ntp synchronization status

Orna Sumszyk orna.sumszyk at gmail.com
Thu Jul 4 07:07:18 UTC 2013

Hello everybody,

I run ntpd in my Linux machine.
In my application running on that computer, I run every second a little
code that checks the ntp synchronization status.
It checks 2 things:
1. The returned string of ntpstat command. If it writes "ntp is not
synchronized", I conclude there is no synchronization. Else I check the
next thing.
2. It runs ntpq and parses the returned string. If the * sign doesn't
appear next to my ntp server (I only have one server in my private network,
it is a tcg device that has a gps clock and also behaves as an ntp server),
I also conclude there is no synchronization.

To check this code, I did the following. I changed the time of my server on
purpose to a wrong time: I added half an hour to it. The server after a
given short time sets back the right time. In my machine (the ntp client),
when I run ntpq every second, I can see that at the beginning, the jitter
value grows a lot. Then it suddenly goes very small but the offset value
grows a lot. Finally, a step is performed and the time is adjusted.
The problem is that until the step is performed, ntpstat returns that it is
synchronized and ntpq still shows the * in my ntp server line. But in fact,
the time is not good and this can be
seen from the jitter and offset values.

So do you think I should refine my monitoring and take into account the
offset and jitter values? Are there other things I should take into
account? Should I do things differently?

Thank you!

More information about the questions mailing list