3
#=========================================================================
4
# Critical Disk Checker utility
6
# This is the same as the disk checker utility but we use it as
7
# a seperate service in Nagios to report on partitions that
8
# have reached 100% capacity.
10
# We have excluded /dev/cd0 because the cdrom drive will always
11
# report 100% capacity if a CD is in the drive.
16
# Email: therocker@pawprints.2y.net
19
#=======================================================================
21
NUMBER=`rsh $1 -l root df -kP | grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f5 | cut -c1-3 | line`
22
TMPFILE=/tmp/tmpcrit.hndl
23
TMPTOO=/tmp/twocrit.hndl
25
if [ "$NUMBER" -eq 100 ]
28
`rsh $1 -l root df -kP |grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f6,5 >> $TMPFILE`
30
LINES=`wc -l /tmp/tmpcrit.hndl | cut -c8`
31
LINESCTL=`wc -l /tmp/tmpcrit.hndl | cut -c8 `
32
echo "Filesystems over 99% --> \c"
34
#===============================================================
35
# Just a little bit to check for multiple occurances of the
37
#===============================================================
39
while [ $LINESCTL != 0 ]
42
cat $TMPFILE | tail -$LINESCTL > $TMPTOO
43
cat $TMPTOO > $TMPFILE
44
LINESCTL=$(( $LINESCTL -1 ))
45
LINES=$(( $LINES -1 ))
46
DATA=`head -1 /tmp/tmpcrit.hndl`
53
#===============================================================
54
# File clean up. Always pick up after yourself. Disk space
55
# doesn't grow on trees you know.
56
#===============================================================
64
echo "No Filesystems over 99%... OK"