pylib documentation / examples?
Hal Murray
halmurray at sonic.net
Fri Jul 19 19:45:05 UTC 2024
> Is there any documentation for ntpsec pylib? And/or examples?
There isn't any documentation. You can read the code. I find it very
hard to read/understand. YMMV.
The best example is probably ntpq
docs/mode6.adoc has a description of the on-wire protocol
I don't know how up to date it is
That may help you understand how things work.
You can use tcpdump to look at the wire while poking a server with ntpq
Most of the answers are text in the form name=value
> For a visualization project, I'm trying to retrieve as much variables
> from a running ntpsec isntance as there are available.
That could be interesting. Please let us know how it turns out.
There are 4 types of data. Maybe more that I can't think of right now.
The first is global variables.
The second is counters.
The third is per-interface data.
The fourth is the mru list.
counters are like global variables but each counter has a friend that is
the value since the last hourly log files were written.
Part of your problem is going to be getting a list of the variables. Look
in ntpd/ntp_control.c
sys_var is a list of the global variables. (I'd like to split that out to
a text file that can be preprocessed and shared by ntp_control and ntpq.)
You can read a global variable with ntpq -c "rv 0 <name>"
"rv 0" with no name will give you the default collection.
The per-interface info is used for ntpq -p
Look for peer_var2 in ntp_control.c
The per-interface stuff needs a magic number. You can get them via ntpq
apeers
Again, "rv <nnn>" will give you the defaults.
--
These are my opinions. I hate spam.
More information about the users
mailing list