cooperlees / monitord

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

[unit state] Parse out how long it's been in said state for #64

Open cooperlees opened 9 months ago

cooperlees commented 9 months ago

It would be handy to record how long something has been on the cuirrent state. For example, how long something has been failed

[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: failed (Result: exit-code) since Thu 2023-12-07 03:13:12 PST; 2 months 0 days ago
   Duration: 6.602s
   Main PID: 2978 (code=exited, status=1/FAILURE)
        CPU: 713ms

Most notibly since Thu 2023-12-07 03:13:12 PST; 2 months 0 days ago

Maybe just save the unix timestamp int so it's easily sortable or some easy to sort/parse string.