cooperlees / monitord

Script to parse systemd units and components health + offer telemetry
GNU General Public License v2.0
22 stars 8 forks source link

[unit state] Handle loaded + inactive (dead) units correctly #65

Closed cooperlees closed 9 months ago

cooperlees commented 9 months ago

This seems wrong. Lets add a test and ensure we do the right thing.

[root@host~]# metalctl monitord unit-state -u cgroup_stats_report_error.service
[
    UnitStateResponse {
        name: "cgroup_stats_report_error.service",
        state: UnitStates {
            active_state: ActiveState::NONEXISTENT,
            load_state: LoadState::NONEXISTENT,
            unhealthy: true,
        },
    },
]
[root@host ~]# systemctl status cgroup_stats_report_error.service
○ cgroup_stats_report_error.service
     Loaded: loaded (/etc/systemd/system/cgroup_stats_report_error.service; static)
    Drop-In: /etc/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: inactive (dead)
cooperlees commented 9 months ago

https://github.com/cooperlees/monitord/commit/f4bca9e2dc34c531eb55b18f27c174d6896ff935 found we didn't handle not-found so added support there.

But we should be handling inactive correctly. Must be an internal bug @ $bigCompany - Will close if I fix it there / backport anything else if I find it.