diff options
| author | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
|---|---|---|
| committer | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
| commit | 44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch) | |
| tree | a1a4d9f7b92412a17ab08f34f04eec45433048b7 /contrib/aix/check_dsk | |
| parent | 54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff) | |
| download | monitoring-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_dsk')
| -rw-r--r-- | contrib/aix/check_dsk | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/contrib/aix/check_dsk b/contrib/aix/check_dsk new file mode 100644 index 00000000..c8ddb3f8 --- /dev/null +++ b/contrib/aix/check_dsk | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | #====================================================================== | ||
| 4 | # Disk Checker utility | ||
| 5 | # | ||
| 6 | # Simple little script that checks the status of all partitions | ||
| 7 | # on a node's hard disks. It will produce a warning alert and list | ||
| 8 | # the offending filesystems in nagios. | ||
| 9 | # | ||
| 10 | # Authors: SpEnTBoY | ||
| 11 | # TheRocker | ||
| 12 | # | ||
| 13 | # Email: lonny@abyss.za.org | ||
| 14 | # therocker@pawprints.2y.net | ||
| 15 | #===================================================================== | ||
| 16 | |||
| 17 | NUMBER=`rsh $1 -l root df -kP | grep -v ":" | grep -E "9[0-9]%" | tr -s ' '| cut -d' ' -f5 | cut -c1-2 | line` | ||
| 18 | TMPFILE=/tmp/tmp.hndl | ||
| 19 | TMPTOO=/tmp/two.hndl | ||
| 20 | |||
| 21 | if [ "$NUMBER" -gt 90 ] | ||
| 22 | then | ||
| 23 | |||
| 24 | `rsh $1 -l root df -kP |grep -v ":" | grep -E "9[0-9]%" | tr -s ' '| cut -d' ' -f6,5 >> $TMPFILE` | ||
| 25 | |||
| 26 | LINES=`wc -l /tmp/tmp.hndl | cut -c8` | ||
| 27 | LINESCTL=`wc -l /tmp/tmp.hndl | cut -c8 ` | ||
| 28 | echo "Filesystems over 90% --> \c" | ||
| 29 | |||
| 30 | #====================================================================== | ||
| 31 | # You'll see this one in a few our shell scripts. Just chcecking for | ||
| 32 | # multiple occurances of the warnign condition. We gotta list 'em all | ||
| 33 | #====================================================================== | ||
| 34 | |||
| 35 | while [ $LINESCTL != 0 ] | ||
| 36 | do | ||
| 37 | |||
| 38 | cat $TMPFILE | tail -$LINESCTL > $TMPTOO | ||
| 39 | cat $TMPTOO > $TMPFILE | ||
| 40 | LINESCTL=$(( $LINESCTL -1 )) | ||
| 41 | LINES=$(( $LINES -1 )) | ||
| 42 | DATA=`head -1 /tmp/tmp.hndl` | ||
| 43 | echo "( $DATA ) \c" | ||
| 44 | |||
| 45 | |||
| 46 | done | ||
| 47 | echo "\n" | ||
| 48 | |||
| 49 | #=============================================================== | ||
| 50 | # Clean up all those nasty tmp files that suck up valuable | ||
| 51 | # disk realestate. | ||
| 52 | #=============================================================== | ||
| 53 | |||
| 54 | rm -f $TMPFILE | ||
| 55 | rm -f $TMPTOO | ||
| 56 | exit 1 | ||
| 57 | |||
| 58 | else | ||
| 59 | |||
| 60 | echo "No Filesystems over 90%... OK" | ||
| 61 | exit 0 | ||
| 62 | fi | ||
