blob: 566e07c1c1b8be83722a80e8a2a722367652039b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
|