check_systemd

This systemd check for nagios compatible monitoring systems will report a degraded systemd to your monitoring solution. It can also be used to monitor individual systemd services and timers units.

.. image:: http://img.shields.io/pypi/v/check-systemd.svg :target: https://pypi.org/project/check-systemd :alt: This package on the Python Package Index

.. image:: https://github.com/Josef-Friedrich/check_systemd/actions/workflows/tests.yml/badge.svg :target: https://github.com/Josef-Friedrich/check_systemd/actions/workflows/tests.yml :alt: Tests

.. image:: https://readthedocs.org/projects/check-systemd/badge/?version=latest :target: https://check-systemd.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status

check_systemd

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.

Installation

::

pip install check_systemd

Packages

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

Command line interface

::

Traceback (most recent call last):
  File "/usr/lib/nagios/plugins/check_systemd", line 61, in 
    import nagiosplugin
ModuleNotFoundError: No module named 'nagiosplugin'

Project pages

  • on github.com__
  • on icinga.com__
  • on nagios.org__

Behind the scenes

dbus ^^^^

  • 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)__

Command line interface (cli) parsing: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To detect failed units this monitoring script runs:

.. code:: sh

systemctl list-units --all

To get the startup time it executes:

.. code:: sh

systemd-analyze

To find dead timers this plugin launches:

.. code:: sh

systemctl list-timers --all

To 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.

Deploying

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