check_systemd is a Nagios /
Icinga monitoring plugin to check
systemd. This Python script will report a
degraded system to your monitoring solution. It can also be used to
monitor individual systemd services (with the -u, --unit parameter)
and timers units (with the -t, --dead-timers parameter). The only
dependency the plugin needs is the Python library
nagiosplugin.
pip install check_systemd
check_systemd on repology.org.
- archlinux
(package,
source
code):
yaourt -S check_systemd - Ubuntu
(package,
source
code):
apt install monitoring-plugins-systemd - Debian
(package,
source
code):
apt install monitoring-plugins-systemd - NixOS
(package,
source
code):
nix-env -iA nixos.check_systemd - Fedora
(package,
source code):
dnf install nagios-plugins-systemd - OracleLinux9 / RHEL9
(package,
source code,
binary):
This package includes one single binary compiled with the Python compiler Nuitka, including all dependencies.
The package is built via GitLab CI as a nightly release and is considered experimental.
curl -L -o check_systemd-1.0-1.x86_64.rpm "https://gitlab.com/msfgitlab/check_systemd_build_rpm/-/jobs/artifacts/main/raw/output/check_systemd-1.0-1.x86_64.rpm?job=release_rpm" && sudo dnf install -y ./check_systemd-1.0-1.x86_64.rpm
Traceback (most recent call last):
File "/usr/lib/nagios/plugins/check_systemd", line 61, in <module>
import nagiosplugin
ModuleNotFoundError: No module named 'nagiosplugin'
- on github.com
- on icinga.com
- on nagios.org
gi: Python 3 bindings for gobject-introspection libraries- GObject is an abstraction layer that allows programming with an object paradigm that is compatible with many languages. It is a part of Glib, the core library used to build GTK+ and GNOME. Website Repo PyPI (PyGObject) Stubs Ubuntu (python3-gi) Debian (python3-gi)
dbus: simple interprocess messaging system (Python 3 interface)- D-Bus is a message bus, used for sending messages between applications. Conceptually, it fits somewhere in between raw sockets and CORBA in terms of complexity. Website Repo PyPI (dbus-python) Ubuntu (python3-dbus) Debian (python3-dbus)
To detect failed units this monitoring script runs:
systemctl list-units --allTo get the startup time it executes:
systemd-analyzeTo find dead timers this plugin launches:
systemctl list-timers --allTo learn how systemd produces the text output on the command line,
it is worthwhile to take a look at systemd’s source code. Files
relevant for text output are:
basic/time-util.c,
analyze/analyze.c.
Edit the version number in check_systemd.py (without v). Use the
-s option to sign the tag (required for the Debian package).
git tag -s v2.0.11 git push --tags