How could I get statistics and maybe a nice ui for my ntp server?

By statistics I mean amount of queries, and maybe in a graph. Have seen it around just not sure how to do it

1 Like

How much ā€œniceā€ it have to be ? :slight_smile:
You can setup some full ā€œblownā€ monitoring with fany UI and a database server as backend or you can setup something simple.

Iā€™m using Munin to monitor my server. For the NTP Server iā€™m using the ntp_packets plugin.

Thereā€™re also some Chrony Plugins (with example graphs)

2 Likes

Sounds good, thanks! I saw a couple options for ntpd but not for chrony so nice to see someone else that uses chrony

for load curves - when i configured munin for this years ago there was no ntp load plugin, so we did a firewall rule doing the counting and let munin graph that one.

Alternatively you could use packages like rrdtool and make your own graphs with them.

And if ā€œnice guiā€ also means administration and configuration of your ntp, companies like Meinberg will happily sell you boxes that have all that.

If you are ok with ansible and running Fedora or similar, there is an ansible role I use for public NTP servers, which installs and configures chrony, collectd, iptables and rrdgraph to collect and plot some statistics, including NTP packet rates.

https://galaxy.ansible.com/mlichvar/chrony_server

1 Like

I tend to agree, performance plots with chrony are not obvious or easy.

munin is and netdata are both good with their respective plugins for chrony but they only provide general statistics output from chronyc.

1 Like

Iā€™m working a bit on something for myself, to see ā€˜live numbersā€™ or analyze a pcap quickly in an ad hoc fashion. Perhaps it is of use to you as well:

NTPtraf2 on Github

Let me know if you have suggestions.

Off course a good tshark (or tcpdump) and iptraf-ng (with appropriate filter), can also give you a quick rough idea of whatā€™s happening.

For long term statistics I prefer Grafana with a home made Prometheus exporter. Hereā€™s an example of what it looks like:

3 Likes

hey, Iā€™m doing sudo tcpdump -i eth0 -n "udp and port 123" -p --immediate-mode -U -s110 -w - 2> /dev/null | ./ntptraf2 - , but getting pcap file [-] with error truncated dump file; tried to read 4 file header bytes, only got 0.

also, from where does prometheus get itā€™s data?

Please check your interface name; it is probably not eth0 but something else.

Prometheus gets itā€™s data from a simple homemade exporter. Basically nothing more than an HTTP-server written in Go that serves a file in the right format. The file is generated with a couple of bash scripts on a regular interval. Itā€™s a bit ugly, but works. When I have time Iā€™ll clean up the code and put it on Github.