Skip to content

Latest commit

 

History

History
158 lines (118 loc) · 5.57 KB

README_template.rst

File metadata and controls

158 lines (118 loc) · 5.57 KB

{{ badge.pypi }}

{{ badge.github_workflow() }}

{{ badge.readthedocs }}

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

{{ cli('check_systemd --help') | literal }}

Project pages

Behind the scenes

dbus

Command line interface (cli) parsing:

To detect failed units this monitoring script runs:

systemctl list-units --all

To get the startup time it executes:

systemd-analyze

To find dead timers this plugin launches:

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.

Testing

pyenv install 3.6.12
pyenv install 3.7.9
pyenv local 3.6.12 3.7.9
pip3 install tox
tox

Test a single test case:

tox -e py38 -- test/test_scope_timers.py:TestScopeTimers.test_all_n_a

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