Expand description
§varlink_unit module
Per-unit detail via the io.systemd.Unit varlink API on PID 1’s socket.
Unit.List itself exists from systemd v258, but the per-type context
sections read here (varlink-service.c, varlink-timer.c) first appear in
v261, which is the real minimum. This is what the varlink path uses
instead of the per-unit D-Bus property fetches in units.rs.
Unit.List can either stream every unit or answer for one named unit.
monitord asks per unit: measured on a test host with 305 units, streaming
all of them costs ~92ms and 1.3MB, against ~0.47ms for a single filtered
call on a warm connection. Break-even is around 198 units, and monitord
wants a handful — the [services] list, the tracked timers, and whichever
units need a oneshot type check. The collectors that do want every unit
(boot_blame, verify) are served from the metrics stream instead.
systemd omits fields that sit at their default rather than sending a zero, so every mapping below has to restate the default the D-Bus property would have returned. Those defaults are asserted in the tests.
Re-exports§
pub use crate::varlink::manager::MANAGER_SOCKET_PATH;
Structs§
- Unit
Lookup - A connection to PID 1’s unit API that remembers what it has already asked.
Functions§
- count_
cgroup_ processes - Count the processes in a unit’s cgroup, including nested ones.
- is_
oneshot - Whether a unit is a oneshot service.
- map_
service_ stats - Map a
Unit.Listreply ontoServiceStats. - map_
timer_ stats - Map a
Unit.Listreply ontoTimerStats. - timer_
triggered_ unit - The unit a timer triggers, e.g. “logrotate.service” for “logrotate.timer”.