ntpsec-rs-mon — ntpmon-rs
Real-time NTP monitoring tool — continuously polls and displays NTP daemon state.
Part of the ntpsec-rs workspace — a forensic Rust reconstruction of NTPsec. Version 0.3.48.
Overview
ntpmon-rs is a real-time NTP monitoring tool that continuously polls a
running ntpd-rs daemon (or any NTPsec-compatible daemon) and displays
live-updating system state and peer status information. It is a forensic Rust
reconstruction of the NTPsec ntpmon Python client.
The tool uses Mode 6 control protocol queries to retrieve:
- System variables — Stratum, leap indicator, offset, frequency, delay, root delay, root dispersion, uptime
- Association status — Configured vs. reachable peers
- Per-peer details — Tally code, remote address, refid, stratum, offset, delay, jitter, reachability register
Usage
Basic Monitoring
Connects to the local NTP daemon (127.0.0.1:123) and displays updates every
2 seconds:
ntpmon-rs v0.3.48 — NTP monitor (Rust)
Monitoring: 127.0.0.1:123 (every 2s)
Press Ctrl-C to stop.
stratum=3 leap=0 offset=0.000456 freq=3.141 delay=0.012345 rootdelay=0.003125 rootdisp=0.001234
uptime=12:34:56 display=
associations: 4 configured, 3 reachable
* ntp.example.com refid=GPS st=2 offset= 0.000456 delay= 0.012345 jitter= 0.000789 reach=ff
+ ntp2.example.com refid=GPS st=2 offset= 0.000321 delay= 0.014567 jitter= 0.000654 reach=ff
- ntp3.example.com refid=GPS st=3 offset=-0.001234 delay= 0.025678 jitter= 0.001111 reach=ff
Monitor a Remote Host
Custom Port
Custom Refresh Interval
Limited Iterations
Command-Line Flags
| Flag | Description | Default |
|---|---|---|
host |
NTP daemon host to monitor | 127.0.0.1 |
-p, --port <port> |
Port number | 123 |
-r, --interval <secs> |
Refresh interval in seconds | 2 |
-n, --count <n> |
Number of iterations (0 = infinite) | 0 |
Display Fields
System Variables
| Field | Description |
|---|---|
stratum |
Daemon's stratum level (1–16) |
leap |
Leap indicator (0=no warning, 1=add leap second, 2=subtract, 3=unsynchronized) |
offset |
Current estimated clock offset in seconds |
freq |
Current frequency offset in PPM (parts per million) |
delay |
Current estimated delay in seconds |
rootdelay |
Total round-trip delay to the primary reference source |
rootdisp |
Total dispersion to the primary reference source |
uptime |
Daemon uptime (formatted as [days]d [hours]:[min]:[sec]) |
Peer Display
Each peer is shown with a tally code indicating its status in the selection algorithm:
| Tally Code | Meaning |
|---|---|
* |
System peer (current synchronization source) |
+ |
Included in the candidate set |
- |
Discarded by the clustering algorithm (falseticker) |
~ |
Configured but unreachable |
|
Normal peer (not selected) |
Additional peer fields:
refid— Reference clock identifierst— Peer stratumoffset— Estimated clock offset in secondsdelay— Round-trip delay in secondsjitter— Offset dispersion in secondsreach— Reachability register (hex, FF = 8 consecutive successful polls)
Signal Handling
ntpmon-rs installs signal handlers for graceful shutdown:
- Ctrl-C (SIGINT) — Stops monitoring and exits cleanly
- SIGTERM — Stops monitoring and exits cleanly
After shutdown, a final message is displayed:
ntpmon-rs: monitoring stopped.
Related Crates
All crates in the ntpsec-rs workspace on crates.io:
| Crate | Description | crates.io |
|---|---|---|
| ntpsec-rs-core | Deterministic engine, wire codec, Mode 6, auth, refclocks, NTS | |
| ntpsec-rs-io | Real I/O layer (system clock, network, state store) | |
| ntpsec-rs | Umbrella facade crate | |
| ntpsec-rs-d | ntpd-rs — NTP daemon binary | |
| ntpsec-rs-query | ntpq-rs — Mode 6 query client | |
| ntpsec-rs-dig | ntpdig-rs — NTP query tool | |
| ntpsec-rs-keygen | NTP key generation | |
| ntpsec-rs-leapfetch | Leap second file fetcher | |
| ntpsec-rs-mon | Real-time NTP monitoring tool | |
| ntpsec-rs-trace | NTP path trace tool | |
| ntpsec-rs-wait | Wait until NTP server reachable | |
| ntpsec-rs-viz | NTP data visualization | |
| ntpsec-rs-frob | NTP configuration manipulator | |
| ntpsec-rs-snmpd | SNMP monitoring daemon | |
| ntpsec-rs-time | Single-shot time query tool | |
| ntpsec-rs-sweep | Sweep through servers collecting stats | |
| ntpsec-rs-loggps | GPS reference clock logging | |
| ntpsec-rs-logtemp | System temperature logging |