ntpsec-rs-logtemp
ntplogtemp-rs — System temperature logging daemon for the ntpsec-rs workspace. Monitors and records system temperature data from sysfs thermal zones, enabling operators to correlate environmental temperature changes with NTP clock stability.
Equivalent to NTPsec's ntplogtemp (Python, ~10K).
Part of the ntpsec-rs workspace — a forensic Rust reconstruction of NTPsec. v0.3.48.
Overview
Temperature variation is one of the most significant environmental factors affecting quartz
oscillator accuracy. As temperature rises or falls, the oscillator frequency shifts,
introducing timing error that the NTP discipline loop must compensate for. The
ntplogtemp-rs daemon records system temperature alongside timestamps so that:
- Post-hoc analysis can correlate clock offset spikes with temperature swings
- Environmental profiling identifies thermally unstable hardware
- Temperature-compensated crystal oscillators (TCXOs) can be validated
- Long-term trend analysis reveals seasonal effects on clock stability
The daemon reads temperature from Linux sysfs thermal zones (typically
/sys/class/thermal/thermal_zone*/temp) and appends timestamped readings to a log file
at a configurable interval.
Oracle
ntpsec ntpclients/ntplogtemp.py (Python, 10K)
Usage
Basic usage (default sysfs path)
Reads CPU temperature from /sys/class/thermal/thermal_zone0/temp every 60 seconds
and appends to /var/log/ntpstats/temperature.
Custom temperature source
For systems with multiple thermal zones (e.g., CPU core, GPU, battery).
Custom output path and interval
Logs temperature every 30 seconds to a custom log file.
Monitoring in real time
Poll every 5 seconds for fine-grained environmental monitoring.
Command-line options
| Option | Description | Default |
|---|---|---|
source |
Temperature source (sysfs path) | /sys/class/thermal/thermal_zone0/temp |
-o, --output |
Output file path | /var/log/ntpstats/temperature |
-i, --interval |
Poll interval in seconds | 60 |
Log format
Each line in the log file contains:
<unix_timestamp> <temperature_celsius>
Example:
1721952000 45.327
1721952060 45.412
1721952120 44.998
Related Crates
All crates in the ntpsec-rs workspace on crates.io:
- ntpsec-rs-core — deterministic engine, wire codec, Mode 6 control, authentication, refclocks, NTS
- ntpsec-rs-io — real I/O layer (system clock, network, state store)
- ntpsec-rs — umbrella facade crate
- ntpsec-rs-d — ntpd-rs daemon binary
- ntpsec-rs-query — ntpq-rs query client
- ntpsec-rs-dig — ntpdig-rs query tool
- ntpsec-rs-keygen — NTP key generation
- ntpsec-rs-leapfetch — leap second file fetcher
- ntpsec-rs-mon — monitoring tool
- ntpsec-rs-trace — NTP trace tool
- ntpsec-rs-wait — NTP wait tool
- ntpsec-rs-viz — NTP visualization
- ntpsec-rs-frob — NTP system utilities
- ntpsec-rs-snmpd — SNMP monitoring daemon
- ntpsec-rs-time — kernel time management
- ntpsec-rs-sweep — NTP sweep tool
- ntpsec-rs-loggps — GPS logging
- ntpsec-rs-logtemp — temperature logging