summaryrefslogtreecommitdiffstats
path: root/contrib/aix/check_io
diff options
context:
space:
mode:
authorEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
committerEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
commit44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch)
treea1a4d9f7b92412a17ab08f34f04eec45433048b7 /contrib/aix/check_io
parent54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff)
downloadmonitoring-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_io')
-rw-r--r--contrib/aix/check_io69
1 files changed, 69 insertions, 0 deletions
diff --git a/contrib/aix/check_io b/contrib/aix/check_io
new file mode 100644
index 0000000..58b25f6
--- /dev/null
+++ b/contrib/aix/check_io
@@ -0,0 +1,69 @@
1#! /bin/sh
2
3#=================================================================
4#
5# I/O Checker (KBPS)
6# This Script uses iostat to monitor disk io
7# Useful for notifications of disk thrashing.
8#
9# Authors: TheRocker
10# SpEnTBoY
11#
12# Email: therocker@pawprints.2y.net
13# lonny@abyss.za.org
14#
15#================================================================
16
17NUMBER1=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c1 | line`
18NUMBER2=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c2 | line`
19TMPFILE=/tmp/iotest.hndl
20TMPTOO=/tmp/iotwo.hndl
21
22#===========================================================
23#
24# We do an evaluation on $NUMBER1 and $NUMBER2 to see if
25# disk io is exceeding 40%.
26#
27#===========================================================
28
29if [ "$NUMBER1" -gt 4 ] && [ "$NUMBER2" -gt 0 ]
30then
31
32 `rsh $1 -l root iostat -d | grep -v cd0 | tr -s ' '| cut -d' ' -f1,2 | grep -e "4[0-9]." >> $TMPFILE`
33
34#====================================================================
35#
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.
39#
40#====================================================================
41
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"
45
46 while [ $LINESCTL != 0 ]
47 do
48
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`
54 echo "( $DATA ) "
55
56
57 done
58 echo "\n"
59
60 rm -f $TMPFILE
61 rm -f $TMPTOO
62 exit 1
63
64else
65
66 print "No Disk I/O Exceeding 40%...OK"
67 exit 0
68
69fi