systemd_exporter icon indicating copy to clipboard operation
systemd_exporter copied to clipboard

Feature request: Recursive systemd unit monitoring

Open bjornfor opened this issue 1 year ago • 0 comments

(Originally posted at https://github.com/prometheus/node_exporter/issues/2830, where it was suggested to post here.)

systemd can connect to systemd inside systemd-nspawn containers to provide a unified view of services from the host.

$ sudo systemctl list-units --recursive
[...normal units *and* units inside systemd-nspawn containers,
    which are prefixed with `<container_name>:`...]

Having this "recursive" option in systemd_exporter would provide easy and robust monitoring of the whole system.

I found that systemd_exporter (and node_exporter) uses https://github.com/coreos/go-systemd to get the state of units, which in turn queries systemd over D-Bus using the org.freedesktop.systemd1.Manager.ListUnits method. I'm not sure if this feature request needs changes to systemd (expose recursive ListUnits?), or if this info can be obtained somehow using multiple D-Bus calls today.

Also worth mentioning is that the systemd CLI (above example) requires root privileges for the --recursive option.

bjornfor avatar Nov 23 '23 19:11 bjornfor