From 536bd24438799a15686415b054f57676b053702d Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Thu, 30 Sep 2021 23:32:45 +0200 Subject: move --- plugins/check_systemd | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 plugins/check_systemd (limited to 'plugins/check_systemd') 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 -- cgit v1.2.3