mirror of
https://github.com/pengutronix/monitoring-check-systemd-service.git
synced 2025-07-21 12:54:38 +02:00
add README
This commit is contained in:
commit
b2233707a3
25
README
Normal file
25
README
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user