3
#=================================================================
6
# This Script uses iostat to monitor disk io
7
# Useful for notifications of disk thrashing.
12
# Email: therocker@pawprints.2y.net
15
#================================================================
17
NUMBER1=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c1 | line`
18
NUMBER2=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c2 | line`
19
TMPFILE=/tmp/iotest.hndl
20
TMPTOO=/tmp/iotwo.hndl
22
#===========================================================
24
# We do an evaluation on $NUMBER1 and $NUMBER2 to see if
25
# disk io is exceeding 40%.
27
#===========================================================
29
if [ "$NUMBER1" -gt 4 ] && [ "$NUMBER2" -gt 0 ]
32
`rsh $1 -l root iostat -d | grep -v cd0 | tr -s ' '| cut -d' ' -f1,2 | grep -e "4[0-9]." >> $TMPFILE`
34
#====================================================================
36
# Of course, there may be more than one hard disk on the node
37
# so we use this bit of code to report on more than one instance
38
# of excessive disk IO.
40
#====================================================================
42
LINES=`wc -l /tmp/iotest.hndl | cut -c8`
43
LINESCTL=`wc -l /tmp/iotest.hndl | cut -c8 `
44
echo "WARNING!!! Disk I/O Exceeding 40% on --> \c"
46
while [ $LINESCTL != 0 ]
49
cat $TMPFILE | tail -$LINESCTL > $TMPTOO
50
cat $TMPTOO > $TMPFILE
51
LINESCTL=$(( $LINESCTL -1 ))
52
LINES=$(( $LINES -1 ))
53
DATA=`head -1 /tmp/iotest.hndl`
66
print "No Disk I/O Exceeding 40%...OK"