From: Michael Howe Date: Fri, 28 Apr 2017 22:53:33 +0000 (+0100) Subject: Add check_systemd plugin X-Git-Tag: 0.14~1 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=02d221dcb536bd6b47d756bd1085f947d4069111;p=packages%2Fn%2Fnagios-plugins-local.git Add check_systemd plugin Very simple - checks the is-system-running output --- diff --git a/debian/changelog b/debian/changelog index 8c5a6ef..1ab0258 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,11 @@ -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 Mon, 21 Dec 2015 21:15:56 +0000 diff --git a/debian/nagios-plugins-local-client.install b/debian/nagios-plugins-local-client.install index d29b8f6..dba27fe 100644 --- a/debian/nagios-plugins-local-client.install +++ b/debian/nagios-plugins-local-client.install @@ -2,3 +2,4 @@ /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 diff --git a/plugins/check_systemd b/plugins/check_systemd new file mode 100755 index 0000000..fa16cf1 --- /dev/null +++ b/plugins/check_systemd @@ -0,0 +1,15 @@ +#!/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