Skip to content

sources

Live samples from the local time daemon (no log files needed).

  • chrony: chronyc -c tracking (CSV). Field order from chrony's client.c: RefID, name, stratum, ref time, System time (current correction; positive = system clock slow, i.e. the ntpd sign convention), last offset (positive = local fast), RMS offset, frequency, residual freq, skew, root delay, root dispersion, update interval, leap status. chronyc -c sourcestats adds per-source estimated offsets (same quantity as statistics.log "Est offset", positive = local fast, negated here).
  • ntpd / NTPsec: ntpq -c rv system variables (offset in ms, ntpd convention; frequency ppm; sys_jitter/clk_jitter ms).

  • linuxptp: pmc -u -b 0 'GET CURRENT_DATA_SET' 'GET TIME_STATUS_NP' (offsetFromMaster and master_offset in ns, local - master, negated here; meanPathDelay ns; gmPresent).

  • facebook/time: ptpcheck stats JSON (ptp.offset_ns, local - master as reported by ptp4l, negated here; ptp.mean_path_delay_ns).

Only a subprocess is used; nothing is installed or configured. The command can be overridden (e.g. ["ssh", "host", "chronyc"]) to watch a remote host.

LocalWatch

Poll the local daemon periodically (same interface as :class:ntpstats.monitor.Monitor).

parse_pmc(text)

Parse pmc CURRENT_DATA_SET / TIME_STATUS_NP responses.

parse_ptpcheck_stats(text)

Parse ptpcheck stats JSON (facebook/time).

prometheus_query_range(url, query, start, end, step='60', timeout=30.0)

Run a Prometheus /api/v1/query_range request and return the JSON document.