diff options
author | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
---|---|---|
committer | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
commit | 44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch) | |
tree | a1a4d9f7b92412a17ab08f34f04eec45433048b7 /contrib/aix/check_crit_dsk | |
parent | 54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff) | |
download | monitoring-plugins-44a321cb8a42d6c0ea2d96a1086a17f2134c89cc.tar.gz |
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib/aix/check_crit_dsk')
-rw-r--r-- | contrib/aix/check_crit_dsk | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/contrib/aix/check_crit_dsk b/contrib/aix/check_crit_dsk new file mode 100644 index 00000000..566e07c1 --- /dev/null +++ b/contrib/aix/check_crit_dsk @@ -0,0 +1,66 @@ +#!/bin/sh + +#========================================================================= +# Critical Disk Checker utility +# +# This is the same as the disk checker utility but we use it as +# a seperate service in Nagios to report on partitions that +# have reached 100% capacity. +# +# We have excluded /dev/cd0 because the cdrom drive will always +# report 100% capacity if a CD is in the drive. +# +# Authors: TheRocker +# SpEnTBoY +# +# Email: therocker@pawprints.2y.net +# lonny@abyss.za.org +# +#======================================================================= + +NUMBER=`rsh $1 -l root df -kP | grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f5 | cut -c1-3 | line` +TMPFILE=/tmp/tmpcrit.hndl +TMPTOO=/tmp/twocrit.hndl + +if [ "$NUMBER" -eq 100 ] +then + + `rsh $1 -l root df -kP |grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f6,5 >> $TMPFILE` + + LINES=`wc -l /tmp/tmpcrit.hndl | cut -c8` + LINESCTL=`wc -l /tmp/tmpcrit.hndl | cut -c8 ` + echo "Filesystems over 99% --> \c" + +#=============================================================== +# Just a little bit to check for multiple occurances of the +# condition. +#=============================================================== + + while [ $LINESCTL != 0 ] + do + + cat $TMPFILE | tail -$LINESCTL > $TMPTOO + cat $TMPTOO > $TMPFILE + LINESCTL=$(( $LINESCTL -1 )) + LINES=$(( $LINES -1 )) + DATA=`head -1 /tmp/tmpcrit.hndl` + echo "( $DATA ) \c" + + + done + echo "\n" + +#=============================================================== +# File clean up. Always pick up after yourself. Disk space +# doesn't grow on trees you know. +#=============================================================== + + rm -f $TMPFILE + rm -f $TMPTOO + exit 2 + +else + + echo "No Filesystems over 99%... OK" + exit 0 +fi |