diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2021-09-30 23:32:45 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2021-09-30 23:32:45 +0200 |
commit | 536bd24438799a15686415b054f57676b053702d (patch) | |
tree | ac5b93d2a342166c3d2d11a867934ec725b7273e /plugins/check_systemd | |
parent | cf666ed055e1e76c5acf0d323d87438bfb8342d6 (diff) | |
download | monitoring_custom-536bd24438799a15686415b054f57676b053702d.tar.gz |
move
Diffstat (limited to 'plugins/check_systemd')
-rwxr-xr-x | plugins/check_systemd | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/check_systemd b/plugins/check_systemd new file mode 100755 index 0000000..bf8d532 --- /dev/null +++ b/plugins/check_systemd @@ -0,0 +1,25 @@ +#!/bin/bash + +# USAGE: +# check_systemd [UNIT ...] + +FAILED=() + +for unit in "$@"; do + if ! systemctl is-active "$unit" > /dev/null; then + FAILED+=("$unit") + fi +done + +if [ ${#FAILED[@]} -gt 0 ]; then + echo "systemd CRITICAL: failed units: ${FAILED[@]}" + exit 2 +fi + +#if ! systemctl is-system-running > /dev/null; then +# echo systemd WARNING: System state degraded. +# exit 1 +#fi + +echo "systemd OK: $# units checked" +exit 0 |