Skip to content

ntpstats.fleet

Fleet view: many hosts at once, ranked by how close each is to its limits.

Each host (a log, or a series of a multi-source file such as a Prometheus range query of the exporter) is assessed over its most recent window seconds against the same thresholds:

max_offset the largest |offset| in the window, reference - local; max_jitter the standard deviation of the offset in the window (what the exporter publishes as ntpstats_offset_stddev_seconds); max_bound the largest error bound in the window, |offset| + delay/2 + root_delay/2 + root_dispersion from the columns the log has (the same terms as :mod:ntpstats.audit and the exporter's ntpstats_offset_bound_seconds); max_age the time since the last sample, relative to now; mask a TDEV or MTIE limit mask (:mod:ntpstats.masks) checked on the window.

A host fails when a threshold is exceeded, is stale when its last sample is older than max_age, and is ok otherwise. Hosts are ranked by their worst usage (value / threshold), so the host closest to a limit comes first even when every host passes. :func:alert_rules writes Prometheus alerting rules with the same thresholds for the exporter's metrics, so the fleet report and the alerts agree.

Thresholds dataclass

Limits every host is checked against (None skips a check).

host_of(s)

A host name for a series: its Prometheus instance label, else its file name.

hosts_of_paths(paths)

Host names for log files: the file's directory when the files sit in different directories (one directory per host), else the file name.

assess(s, th, now=None, host=None)

One host against the thresholds; see the module docstring.

format_age(v)

A duration for people: s, min, h or d.

fleet(series, th, now=None, hosts=None)

Assess every series and rank them: failures first, then stale hosts, then by usage of the nearest limit (highest first).

alert_rules(th, group='ntpstats-fleet', for_='10m')

Prometheus alerting rules (YAML) for the exporter's metrics (:mod:ntpstats.metrics) with the same thresholds as the fleet view.