Very simple - checks the is-system-running output
-nagios-plugins-local (0.14~test.2) UNRELEASED; urgency=low
+nagios-plugins-local (0.14~test.3) UNRELEASED; urgency=low
* nagios-plugins-local-server:
- new plugin: check_mqtt
- fix dependency
* nagios-plugins-local-client:
- new plugin: check_iostat
+ - new plugin: check_systemd
-- Michael Howe <michael@michaelhowe.org> Mon, 21 Dec 2015 21:15:56 +0000
/usr/lib/nagios/plugins/check_configtool
/usr/lib/nagios/plugins/check_md_raid
/usr/lib/nagios/plugins/check_iostat
+/usr/lib/nagios/plugins/check_systemd
--- /dev/null
+#!/bin/bash
+
+STATE=$(systemctl is-system-running)
+
+if [ "$STATE" == "running" ]; then
+ echo "systemd running"
+ exit 0
+else
+ echo -n "systemd in state $STATE - failed units: "
+ systemctl list-units --state=failed | awk '/ failed / {print $2}' | tr '\n' ' '
+ exit 2
+fi
+
+# if we've got this far, we don't know what state we're in
+exit 3