Skip to content
Snippets Groups Projects

check_http first lines

Merged Hahn Axel (hahn) requested to merge add-systemdunit into master
2 files
+ 79
21
Compare changes
  • Side-by-side
  • Inline

Files

+ 40
4
@@ -16,7 +16,7 @@ A unit is everything listed by systemctl command - services, timers, targets, ..
______________________________________________________________________
CHECK_SYSTEMDUNIT
v1.0
v1.1
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
@@ -30,21 +30,53 @@ 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
check_systemdunit [-h|-l|-s] UNIT
OPTIONS:
-h this help
-l list all units
-s list service units
UNIT Name of a unit - see output of 'systemctl'
EXAMPLES:
check_systemdunit mysql.service
show status of service mysql
check_systemdunit -s
list all existing services. For a unit check you need to add the name
in the 1st column.
check_systemdunit nginx.service
show status of nginx webservice
```
## Examples
### List services
You maybe want to start to get a list of services to pick an existing one that you wanna check periodically.
You can use ``systemctl --no-legend --no-pager --type service`` or ``$ ./check_systemdunit -s``
```txt
List of service units:
alsa-restore.service loaded active exited Save/Restore Sound Card State
apparmor.service loaded active exited Load AppArmor profiles
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
bluetooth.service loaded active running Bluetooth service
clamav-daemon.service loaded active running Clam AntiVirus userspace daemon
clamav-freshclam.service loaded active running ClamAV virus database updater
colord.service loaded active running Manage, Install and Generate Color Profiles
cronie.service loaded active running Periodic Command Scheduler
...
```
### Check a service
To check a single service you need to add the unit name in the 1st column.
``$ ./check_systemdunit nginx`` returns
```txt
@@ -67,3 +99,7 @@ If a service does not exist: ``./check_systemdunit justadummy`` returns
```txt
CRITICAL: Unit justadummy.service could not be found.
```
### Other units
With ``$ ./check_systemdunit -l`` you get a grouped list of all unit types. check_systemdunit handles all types - not only services.
Loading