[ntp:questions] Synchronization and Non-Synchronization status
Jaiprabhu
jaiprabhu at somewhere.in.this.world
Fri Feb 19 23:15:22 UTC 2010
Jaiprabhu wrote:
> Assuming the following config:
>
> [...]
> restrict default kod nomodify notrap noquery
> restrict 127.0.0.1
> driftfile ....
> server <server1> minpoll <N> maxpoll <M>
> server <server2> minpoll <N> maxpoll <M>
> server <server3> minpoll <N> maxpoll <M>
> [...]
>
> I need to do the following:
>
> 1. Set a global "sync" status when we are sure that NTPd is synchronized
> to *at least* one server.
> 2. Set a global "not-sync" status when we are sure that NTPd is
> not-synchronized to *any* of the configured server, when there was a
> prior "sync" condition
>
> There are two parts to my problem:
>
> 1. How do I find out the "sync" and "not-sync" status from NTPd
> 2. How do I make NTPd tell me when it reaches "sync" and when it is
> "not-sync". It's probably ok if I can use parse a log message generated
> by NTPd to figure this out.
>
> Can someone please tell me a reliable way to determine these two things.
> For 1 I could perhaps read the 'ntpq -pn' billboard and look at the
> tally codes. If there is a sys.peer ("*") in the list then I guess we
> are in "sync" status. For 1, I am not sure what the "not-sync" condition
> is though.
>
> Many thanks.
Anyone?
The thing I am most interested in resolving is, in which part of NTPd,
and how, can I determine that there are no valid peers left (either they
are unreachable or are not reliable servers) and therefore determine the
current global synchronization status to be "not-sync". One of ideas I
am toying with is to edit ntp_proto.c and going through the list of all
configured servers at the end of clock_select() and verifying that at
least one of the servers is a sys.peer. If not, then I send a signal out
to tell whoever is listening that NTP is "not-sync".
The option of looking at the billboard every poll interval (excecuting
'ntpq -pe') and looking for the "*" tally code is always present but I
would want to avoid this polling mechanism. Instead, I would prefer
receiving of the "not-sync" status from withing NTPd itself.
I would really appreciate if someone can give me some input on this.
Thanks in advance.
More information about the questions
mailing list