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_crit_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_crit_dsk')
-rw-r--r-- | contrib/aix/check_crit_dsk | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/contrib/aix/check_crit_dsk b/contrib/aix/check_crit_dsk new file mode 100644 index 00000000..566e07c1 --- /dev/null +++ b/contrib/aix/check_crit_dsk | |||
@@ -0,0 +1,66 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #========================================================================= | ||
4 | # Critical Disk Checker utility | ||
5 | # | ||
6 | # This is the same as the disk checker utility but we use it as | ||
7 | # a seperate service in Nagios to report on partitions that | ||
8 | # have reached 100% capacity. | ||
9 | # | ||
10 | # We have excluded /dev/cd0 because the cdrom drive will always | ||
11 | # report 100% capacity if a CD is in the drive. | ||
12 | # | ||
13 | # Authors: TheRocker | ||
14 | # SpEnTBoY | ||
15 | # | ||
16 | # Email: therocker@pawprints.2y.net | ||
17 | # lonny@abyss.za.org | ||
18 | # | ||
19 | #======================================================================= | ||
20 | |||
21 | NUMBER=`rsh $1 -l root df -kP | grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f5 | cut -c1-3 | line` | ||
22 | TMPFILE=/tmp/tmpcrit.hndl | ||
23 | TMPTOO=/tmp/twocrit.hndl | ||
24 | |||
25 | if [ "$NUMBER" -eq 100 ] | ||
26 | then | ||
27 | |||
28 | `rsh $1 -l root df -kP |grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f6,5 >> $TMPFILE` | ||
29 | |||
30 | LINES=`wc -l /tmp/tmpcrit.hndl | cut -c8` | ||
31 | LINESCTL=`wc -l /tmp/tmpcrit.hndl | cut -c8 ` | ||
32 | echo "Filesystems over 99% --> \c" | ||
33 | |||
34 | #=============================================================== | ||
35 | # Just a little bit to check for multiple occurances of the | ||
36 | # condition. | ||
37 | #=============================================================== | ||
38 | |||
39 | while [ $LINESCTL != 0 ] | ||
40 | do | ||
41 | |||
42 | cat $TMPFILE | tail -$LINESCTL > $TMPTOO | ||
43 | cat $TMPTOO > $TMPFILE | ||
44 | LINESCTL=$(( $LINESCTL -1 )) | ||
45 | LINES=$(( $LINES -1 )) | ||
46 | DATA=`head -1 /tmp/tmpcrit.hndl` | ||
47 | echo "( $DATA ) \c" | ||
48 | |||
49 | |||
50 | done | ||
51 | echo "\n" | ||
52 | |||
53 | #=============================================================== | ||
54 | # File clean up. Always pick up after yourself. Disk space | ||
55 | # doesn't grow on trees you know. | ||
56 | #=============================================================== | ||
57 | |||
58 | rm -f $TMPFILE | ||
59 | rm -f $TMPTOO | ||
60 | exit 2 | ||
61 | |||
62 | else | ||
63 | |||
64 | echo "No Filesystems over 99%... OK" | ||
65 | exit 0 | ||
66 | fi | ||