summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Fenzi <kevin@scrye.com>2015-02-19 15:34:21 +0000
committerKevin Fenzi <kevin@scrye.com>2015-02-19 15:34:21 +0000
commit3068bc611e64584f328c60c01be2d5d95c5bf3fb (patch)
tree148c4ea601c0f44d8c8d467d0c6e9d8ddfd69c00
parent586efb310d2f090ab19ad5adc1ee5b1ee19864e0 (diff)
downloadansible-3068bc611e64584f328c60c01be2d5d95c5bf3fb.tar.gz
ansible-3068bc611e64584f328c60c01be2d5d95c5bf3fb.tar.xz
ansible-3068bc611e64584f328c60c01be2d5d95c5bf3fb.zip
Lets try and fix up checks on pkgs02
-rwxr-xr-xroles/nagios_client/files/scripts/check_readonly_fs84
-rw-r--r--roles/nagios_client/tasks/main.yml2
-rw-r--r--roles/nagios_client/templates/check_disk.cfg.j21
-rw-r--r--roles/nagios_client/templates/check_readonly_fs.cfg.j21
4 files changed, 88 insertions, 0 deletions
diff --git a/roles/nagios_client/files/scripts/check_readonly_fs b/roles/nagios_client/files/scripts/check_readonly_fs
new file mode 100755
index 000000000..cd2b1973a
--- /dev/null
+++ b/roles/nagios_client/files/scripts/check_readonly_fs
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# check_readonlyfs: Check for readonly filesystems
+# Copyright (C) 2010 Davide Madrisan <davide.madrisan@gmail.com>
+
+PROGNAME=`/bin/basename $0`
+PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
+REVISION=`echo '$Revision: 1 $' | sed -e 's/[^0-9.]//g'`
+
+. $PROGPATH/utils.sh
+
+print_usage() {
+ echo "Usage: $PROGNAME --no-network-fs"
+ echo "Usage: $PROGNAME --help"
+ echo "Usage: $PROGNAME --version"
+}
+
+print_help() {
+ print_revision $PROGNAME $REVISION
+ echo ""
+ print_usage
+ echo ""
+ echo "readonly filesystem checker plugin for Nagios"
+ echo ""
+ support
+}
+
+NETFS=1
+
+# Grab the command line arguments
+
+exitstatus=$STATE_WARNING #default
+
+while test -n "$1"; do
+ case "$1" in
+ --help|-h)
+ print_help
+ exit $STATE_OK
+ ;;
+ --version|-V)
+ print_revision $PROGNAME $REVISION
+ exit $STATE_OK
+ ;;
+ --no-network-fs|-n)
+ NETFS="0"
+ ;;
+ *)
+ echo "Unknown argument: $1"
+ print_usage
+ exit $STATE_UNKNOWN
+ ;;
+ esac
+ shift
+done
+
+[ -r /proc/mounts ] || { echo "cannot read /proc/mounts!"; exit $STATE_UNKNOWN; }
+
+nerr=0
+IFS_SAVE="$IFS"
+
+rofs_list=""
+while read dev mp fs mopt ignore; do
+ [ "$dev" = none ] && continue
+ case $fs in binfmt_misc|devpts|iso9660|proc|selinuxfs|rpc_pipefs|sysfs|tmpfs|usbfs)
+ continue ;;
+ esac
+ case $fs in autofs|nfs|nfs4|smbfs)
+ # skip the network filesystems
+ [ "$NETFS" = 0 ] && continue ;;
+ esac
+
+ IFS=","; set -- $mopt; IFS="$IFS_SAVE"
+ while :; do
+ case "$1" in
+ ro) rofs_list="$rofs_list $mp"; nerr=$(( $nerr + 1 )) ;;
+ "") shift; break ;;
+ esac
+ shift
+ done
+done < <(LC_ALL=C /bin/cat /proc/mounts 2>/dev/null)
+
+[ $nerr -eq 0 ] && { echo OK; exit $STATE_OK; } || echo "$rofs_list: read only fs"
+
+exit $exitstatus
diff --git a/roles/nagios_client/tasks/main.yml b/roles/nagios_client/tasks/main.yml
index 4cafff151..1d5a5b0fe 100644
--- a/roles/nagios_client/tasks/main.yml
+++ b/roles/nagios_client/tasks/main.yml
@@ -33,6 +33,7 @@
- check_supybot_plugin
- check_datanommer_timesince.py
- check_memcache_connect
+ - check_readonly_fs
when: not inventory_hostname.startswith('noc')
tags:
- nagios_client
@@ -78,6 +79,7 @@
with_items:
- check_mirrorlist_cache.cfg
- check_raid.cfg
+ - check_readonly_fs.cfg
- check_cron.cfg
- check_disk.cfg
- check_swap.cfg
diff --git a/roles/nagios_client/templates/check_disk.cfg.j2 b/roles/nagios_client/templates/check_disk.cfg.j2
index c20da22c5..6eb12a676 100644
--- a/roles/nagios_client/templates/check_disk.cfg.j2
+++ b/roles/nagios_client/templates/check_disk.cfg.j2
@@ -1,2 +1,3 @@
command[check_disk_/]={{ libdir }}/nagios/plugins/check_disk -w 15% -c 10% -p /
command[check_disk_/boot]={{ libdir }}/nagios/plugins/check_disk -w 15% -c 10% -p /boot
+command[check_disk_/srv/cache/lookaside]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /srv/cache/lookaside
diff --git a/roles/nagios_client/templates/check_readonly_fs.cfg.j2 b/roles/nagios_client/templates/check_readonly_fs.cfg.j2
new file mode 100644
index 000000000..df896b7dc
--- /dev/null
+++ b/roles/nagios_client/templates/check_readonly_fs.cfg.j2
@@ -0,0 +1 @@
+command[check_readonly_fs]=/usr/lib64/nagios/plugins/check_readonly_fs