AW: check_disk best practices
Helmut Januschka
h.januschka at krone.at
Fri Aug 20 14:37:44 CEST 2004
We are using a selfmade check disk plugin based on "df -h"
Run it with -h :))
So long
Helmut
----SNIP----
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 1.0 $' | sed -e 's/[^0-9.]//g'`
. $PROGPATH/utils.sh
print_usage() {
echo -e "Check Disk Plugin $REVISION\nWritten by Helmut Januschka(helmut at januschka.com)"
echo -e "* Df -h on all partitions and checks if a partition wich is not -x excluded is lower than X percent";
echo "---------------------Usage-----------------------------------------------"
echo "-w WARN if lower than percent are free DEF=95"
echo "-c CRITICAL if lower than percent are free DEF=98"
echo "-x XClude device Can be used more then one time DEF:(No device is excluded)";
echo "-h Show This Help"
echo "-------------------------------------------------------------------------"
print_revision
}
#Defs:
WARN=95
CRIT=98
XCLUDE="df -h|grep -v Use"
CS=""
WS=""
while getopts w:c:x:h o
do
case $o in
w) WARN=$OPTARG;;
c) CRIT=$OPTARG;;
x) XCLUDE="$XCLUDE|grep -v $OPTARG";;
h) print_usage; exit $STATE_UNKOWN;;
esac
done
checkDisks() {
eval $XCLUDE|while read mnt size used avail perc partition; do
P=`echo $perc|tr -d \%`
if [ "$size" = "" ]; then
continue;
fi;
if [ $P -lt $WARN ] && [ $P -lt $CRIT ]; then
echo -e "$partition - $P% ($avail/$size) Free OK";
fi;
if [ $P -gt $CRIT ]; then
echo -e "$partition - $P% ($avail/$size) Free CRITICAL";
fi;
if [ $P -gt $WARN ]; then
echo -e "$partition - $P% ($avail/$size) Free WARNING";
fi;
done;
}
CS=`checkDisks|grep "CRIT"|tr -d "\n"`
WS=`checkDisks|grep "WARN"|tr -d "\n"`
OS=`checkDisks|grep "O"|tr -d "\n"`
if [ "$CS" != "" ]; then
echo "!!!CRITICAL!!! $CS";
exit $STATE_CRITICAL;
fi;
if [ "$WS" != "" ]; then
echo "!!!WARNING $WS";
exit $STATE_WARNING;
fi;
echo "DISKs OK: $OS";
exit $STATE_OK;
----SNIP----
-----Ursprüngliche Nachricht-----
Von: Gregg Strickland [mailto:gstrickland at live365.com]
Gesendet: Freitag, 20. August 2004 03:39
An: nagios-users at lists.sourceforge.net
Betreff: [Nagios-users] check_disk best practices
I'm looking for advice on the best way to set up disk monitoring (linux specifically). Every server I've been tasked to monitor is a little bit different in how it is partitioned, so rather than have a service for each partition and then keeping track of it all it makes sense to omit the -p and have it generically check all filesystems. The problem is that the current stable check_disk does what looks like a "df -Pk" instead of a "df -Plk" so I'm picking up mounted filesystems in the output.
I'd like some tips and tricks from the rest of you on how you handle check_disk in your environments.
thanks in advance!
-greggs
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list