Open
Description
The Context
As described in #12, substates are often more describing. For example, we're using cloud-init, which has a unit of Type=oneshot
. Those run a single time, and afterwards have ActiveState=active
but SubState=exited
.
Example unit:
$ systemctl status cloud-final
● cloud-final.service - Execute cloud user/final scripts
Loaded: loaded (/lib/systemd/system/cloud-final.service; enabled; vendor preset: enabled)
Active: active (exited) since Thu 2020-05-07 07:03:55 UTC; 1 weeks 6 days ago
Process: 1118 ExecStart=/usr/bin/cloud-init modules --mode=final (code=exited, status=0/SUCCESS)
Main PID: 1118 (code=exited, status=0/SUCCESS)
Tasks: 0
Memory: 544.9M
CGroup: /system.slice/cloud-final.service
The Issue
systemd_exporter tries to scrape cgroup information for this unit. From reading the code, I see this switch/case statement must be extended to exclude some substates (or probably better: include only really active ones, #12 has a more comprehensive list that can be used to derive): https://github.com/povilasv/systemd_exporter/blob/master/systemd/systemd.go#L578