ClementTsang / bottom

Yet another cross-platform graphical process/system monitor.
https://clementtsang.github.io/bottom
MIT License
9.79k stars 233 forks source link

Failed systemd units? #1088

Closed swsnr closed 2 weeks ago

swsnr commented 1 year ago

Checklist

Describe the feature request

I think on Linux failed systemd units (i.e. what systemctl --failed shows) would be a helpful metric (perhaps just as a simple counter).

Would you be open for a corresponding merge request?

ClementTsang commented 1 year ago

It could be interesting, design shouldn't be that hard either. Do you happen to know if there's a library way of getting this data?

And yeah, I would be happy to get any PRs.

swsnr commented 1 year ago

systemd exposes this information over dbus:

# busctl call --system org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager ListUnitsByPatterns asas 1 "failed" 0
a(ssssssouso) 1 "fwupd-refresh.service" "Refresh fwupd metadata and update motd" "loaded" "failed" "failed" "" "/org/freedesktop/systemd1/unit/fwupd_2drefresh_2eservice" 0 "" "/"

zbus is a good pure Rust library for DBus. It's rather heavy though and brings in a lot of dependencies.

Also, I believe DBus calls aren't that cheap, so perhaps bottom should make these calls asynchronously and at a much lower interval than e.g. reading CPU load. Would this be possible in bottom?

ClementTsang commented 1 year ago

That would definitely be possible to do, though currently we only have one main configurable refresh rate for data, so it might be worth introducing a second one for something like this if we need it.

swsnr commented 2 weeks ago

Realistically I'll not find time for this so I might just as well close this.