summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-09-06 15:02:15 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-09-06 15:02:15 +0200
commitc92be7823ce1ab851126b347d7180dda549ba5a6 (patch)
tree41aed19211ed4951fa87a7b6aceee8aba4a5b404
parenta04bcc892d26131a35a900f45ec3eea7980519a4 (diff)
downloaditzks-systems-c92be7823ce1ab851126b347d7180dda549ba5a6.tar.gz
itzks-systems-c92be7823ce1ab851126b347d7180dda549ba5a6.tar.bz2
itzks-systems-c92be7823ce1ab851126b347d7180dda549ba5a6.zip
Monitoring: Add check_fs_ro.sh plugin.
-rw-r--r--debian/changelog10
-rw-r--r--usr-lib-nagios-plugins/check_fs_ro.sh67
2 files changed, 75 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 38b0256..8a25069 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,16 @@
-itzks-systems (2016.07.27.2) UNRELEASED; urgency=medium
+itzks-systems (2016.07.27.3) UNRELEASED; urgency=medium
+
+ * Monitoring: Add check_fs_ro.sh plugin.
+
+ -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Tue, 06 Sep 2016 15:01:51 +0200
+
+itzks-systems (2016.07.27.2) unstable; urgency=medium
* debian/control:
+ Prepare for diskless chroots being amd64 systems. Use linux-image
or linux-image-amd64 alternatively.
- -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 27 Jul 2016 12:44:32 +0200
+ -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 27 Jul 2016 12:45:31 +0200
itzks-systems (2016.07.27.1) unstable; urgency=medium
diff --git a/usr-lib-nagios-plugins/check_fs_ro.sh b/usr-lib-nagios-plugins/check_fs_ro.sh
new file mode 100644
index 0000000..bed8083
--- /dev/null
+++ b/usr-lib-nagios-plugins/check_fs_ro.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# Copyright (C) 2016 Mike Gabriel
+#
+# File: check_fs_ro.sh
+# Author: Mike Gabriel
+# Date: 06 Sep 2016
+# Version: 0.11
+
+# LICENSE: MIT/Expat
+
+set -f
+shopt -u extglob
+
+# Program args
+ME="$0"
+CMDLINE="$@"
+
+NAGOK=0
+NAGWARN=1
+NAGCRIT=2
+NAGUNKN=3
+
+usage()
+{
+ echo "Check that ext[2|3|4], btrfs or xfs filesystems are not read-only."
+}
+
+parse_options()
+{
+ local new
+
+ set -- $CMDLINE
+ while true
+ do
+ case $1 in
+ #-v) shift ; gVersion=$1
+ #;;
+ -h) usage ; exit 0
+ ;;
+ ?*) echo "Syntax error." ; exit 1
+ ;;
+ esac
+ shift 1 || break
+ done
+}
+
+main()
+{
+ parse_options
+
+ retval=$NAGOK
+
+ grep -E '^.*\ .*\ (ext.*|btrfs|xfs)\ ro,.*$' /proc/mounts | while read fs; do
+ rofs=`echo $fs | awk '{ print $2; }'`
+ echo "CRITICAL: $rofs is a read-only filesystem."
+ done
+
+ if ! grep -E '^.*\ .*\ (ext.*|btrfs|xfs)\ ro,.*$' /proc/mounts 1>/dev/null; then
+ echo "OK."
+ else
+ retval=$NAGCRIT
+ fi
+
+ exit $retval
+}
+
+main