Skip to content
Snippets Groups Projects
Commit 805463ca authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

ad doc page

parent 3ab9de15
Branches
No related tags found
1 merge request!161Add systemdunit
...@@ -49,6 +49,7 @@ There is one include script used by all checks: ...@@ -49,6 +49,7 @@ There is one include script used by all checks:
* check_ssl * check_ssl
* check_ssl_certs * check_ssl_certs
* check_systemdservices * check_systemdservices
* [check_systemdunit](check_systemdunit.md)
* check_timesync * check_timesync
* check_uptime * check_uptime
* hello * hello
# 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.
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment