Werk #19328: systemd unit: only create host labels for matching units
| Component | Checks & agents | ||||
| Title | systemd unit: only create host labels for matching units | ||||
| Date | Jul 2, 2026 | ||||
| Level | Trivial Change | ||||
| Class | Bug Fix | ||||
| Compatibility | Incompatible - Manual interaction might be required | ||||
| Checkmk versions & editions |
|
When the Systemd Service Summary discovery rule was configured to create host labels for discovered units (via Automatic generation of host labels or Explicit host labels), Checkmk created those labels for every systemd unit on the host — not just the units matching the rule's name, description and state conditions.
As a result, a rule restricting the labels to, for example, ~apache still
produced cmk/systemd/unit/<name>:yes labels for nginx, mysql and all other
units, and explicit labels were attached regardless of the configured
restrictions.
The root cause was that label creation was decoupled from the rule that actually matched a unit: each matched unit was labelled with the settings of all configured rules, and the empty default parameters (which match every unit) caused every unit to be considered matched.
With this werk, a unit only receives the host labels of the rule(s) whose name, description and state conditions it actually satisfies. Units that do not match any label-producing rule no longer get spurious labels.
This change is incompatible: hosts that previously carried
cmk/systemd/unit/<name>:yes (or explicit) labels for non-matching units will
lose them on the next service discovery / host label update. Rules, host and
service conditions, views and filters that relied on those unintended labels
must be adjusted.