~ubuntu-branches/ubuntu/precise/nagios-plugins/precise-proposed

« back to all changes in this revision

Viewing changes to contrib/aix/check_io

  • Committer: Bazaar Package Importer
  • Author(s): Guido Trotter
  • Date: 2004-06-15 15:37:48 UTC
  • Revision ID: james.westby@ubuntu.com-20040615153748-pq7702qdzghqfcns
Tags: upstream-1.3.1.0
ImportĀ upstreamĀ versionĀ 1.3.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
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
 
21
 
 
22
#===========================================================
 
23
#
 
24
#  We do an evaluation on $NUMBER1 and $NUMBER2 to see if
 
25
#  disk io is exceeding 40%.
 
26
#
 
27
#===========================================================
 
28
 
 
29
if [ "$NUMBER1" -gt 4 ] && [ "$NUMBER2" -gt 0 ]
 
30
then
 
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
 
 
64
else   
 
65
 
 
66
   print "No Disk I/O Exceeding 40%...OK"
 
67
   exit 0
 
68
 
 
69
fi