systemd

Reference for the `systemd` collector.

systemd · collector · run nanook doc systemd for the same content in your terminal.

Tracks systemd unit ActiveState and SubState via the system DBus.

Options

OptionTypeDefaultDescription
unitsstringrequiredlist of unit names to monitor (e.g. ["nginx.service", "sshd.service"])

Metrics

MetricKindUnitDescription
systemd.activebooltrue when the unit's ActiveState is active. Labels: unit.
systemd.stateenumActiveState as a labelled enum. Labels: unit.
systemd.sub_stateenumSubState as a labelled enum. Labels: unit.

Examples

Watch a single unit

[[collectors]]
name = "nginx"
kind = "systemd"
interval = 30
[collectors.opts]
units = ["nginx.service"]

Alert when a service stops being active

[[alerts]]
expr = 'nginx::systemd.active == 0'
count = 1
channel = "ops"

Multiple units in one collector

[[collectors]]
name = "core"
kind = "systemd"
[collectors.opts]
units = ["sshd.service", "nginx.service", "postgresql.service"]

[[alerts]]
expr = 'core::systemd.state is "failed"'
count = 1
channel = "ops"