From b2233707a30fc37f2d2f67c8c3ebd0f336ab982c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20L=C3=A4ssig?= Date: Fri, 24 Jun 2016 14:13:25 +0200 Subject: [PATCH] add README --- README | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..b8c0de4 --- /dev/null +++ b/README @@ -0,0 +1,25 @@ +Whats this? +=========== +This script is intended for icinga/nagios/icinga2 to check the state of a +systemd service. We check the ServiceState and the Substate. + +optional features (future) +-------------------------- +It is thinkable to check for every systemd service property. + +example code +------------ + +from gi.repository import GLib, Gio + +systemd = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SYSTEM, 0, None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.systemd1.Manager', None) + +apache2 = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SYSTEM, 0, None, 'org.freedesktop.systemd1', systemd.LoadUnit('(s)', 'apache2.service'), 'org.freedesktop.systemd1.Unit', None) + +apache2.get_cached_property('ActiveState').unpack() +-> 'active' + apache2.get_cached_property('SubState').unpack() + -> 'running' + + apache2.get_cached_property_names() + -> Liste all systemd-properties