From 805463cae7ac144b7d3fd947c8a021d5f15a1ae6 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Tue, 5 Sep 2023 16:33:29 +0200 Subject: [PATCH] ad doc page --- docs/20_Checks/_index.md | 1 + docs/20_Checks/check_systemdunit.md | 69 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 docs/20_Checks/check_systemdunit.md diff --git a/docs/20_Checks/_index.md b/docs/20_Checks/_index.md index c874e5f..134d2b7 100644 --- a/docs/20_Checks/_index.md +++ b/docs/20_Checks/_index.md @@ -49,6 +49,7 @@ There is one include script used by all checks: * check_ssl * check_ssl_certs * check_systemdservices +* [check_systemdunit](check_systemdunit.md) * check_timesync * check_uptime * hello diff --git a/docs/20_Checks/check_systemdunit.md b/docs/20_Checks/check_systemdunit.md new file mode 100644 index 0000000..a73a107 --- /dev/null +++ b/docs/20_Checks/check_systemdunit.md @@ -0,0 +1,69 @@ +# Check Systemd unit + +## Introduction + +This check shows the status of a systemd unit. + +A unit is everything listed by systemctl command - services, timers, targets, ... + +## Requirements + +* `systemctl` binary + +## Syntax + +```txt +______________________________________________________________________ + +CHECK_SYSTEMDUNIT +v1.0 + +(c) Institute for Medical Education - University of Bern +Licence: GNU GPL 3 + +https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_systemdunit.html +______________________________________________________________________ + +Check a unit using systemctl status. + +The status is unknown if the command systemctl is not found. +The status is critical if the service does not exist or is not running. + +SYNTAX: + check_systemdunit [-h] UNIT + +OPTIONS: + -h this help + UNIT Name of a unit - see output of 'systemctl' + +EXAMPLES: + + check_systemdunit mysql.service + show status of service mysql + +``` + +## Examples + +``$ ./check_systemdunit nginx`` returns + +```txt +OK: ● nginx.service - A high performance web server and a reverse proxy server + Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled) + Active: active (running) since Tue 2023-09-05 08:04:45 CEST; 8h ago + Process: 577 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=0/SUCCESS) + Main PID: 612 (nginx) + Tasks: 2 (limit: 18881) + Memory: 3.0M + CPU: 38ms + CGroup: /system.slice/nginx.service + ├─612 "nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr;" + └─613 "nginx: worker process" +... +``` + +If a service does not exist: ``./check_systemdunit justadummy`` returns + +```txt +CRITICAL: Unit justadummy.service could not be found. +``` -- GitLab