[systemd-devel] Monitoring whether all dependencies of a target are active

Reto Kaiser reto at cargomedia.ch
Wed Aug 24 14:50:32 UTC 2016


We just migrated to Systemd and we love it!

Now I'm looking for a way to monitor if all the "important units" of my
system are running or not.
My plan is to create a target that "wants" all those important units.
Then I'll just need to check that the dependencies of those units
are active. If there are non-active units for 5 minutes or more
I'll trigger an alert.

Do you think that's a good way to check the healthiness of my units, or is
there a better way?

And what is the best way to check if all dependent units of a target are
active?
I could do something like:
--------------------
for unit in $(systemctl list-dependencies --plain --full sk.target); do if
[ "${unit}" != "●" ]; then echo "${unit}: $(systemctl
is-active "${unit}")"; fi; done
--------------------

But I'm wondering if there's a more programmatic way of querying
that information (without filtering those status "dots")?

Thanks,
 Reto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160824/bdf96dd5/attachment.html>


More information about the systemd-devel mailing list