2006-04-07 16:41:51 +02:00
|
|
|
#!/bin/sh
|
|
|
|
## give max disk usage in %, after that a warning will be produced
|
2006-04-07 17:32:28 +02:00
|
|
|
MAX=15
|
2006-04-07 16:41:51 +02:00
|
|
|
## looks for mounted filesystems, but not proc,sys,...
|
|
|
|
DISKS=`mount |grep -iv proc |grep -iv sysfs |awk '{print $3}'`
|
2006-04-10 12:15:09 +02:00
|
|
|
# retrieve the IP, as the hostname is not always unique
|
|
|
|
IP=$(/sbin/ifconfig eth0 | grep "inet addr:" | sed 's/^.*inet addr:\([0-9\.]*\).*$/\1/')
|
2006-04-07 16:41:51 +02:00
|
|
|
|
|
|
|
for DISK in $DISKS; do
|
|
|
|
USAGE=`df -k $DISK | tail -n 1 | awk '{print $5}' | cut -d"%" -f1`
|
|
|
|
# if no number is given as percentage, do nothing
|
2006-04-10 12:15:09 +02:00
|
|
|
echo "$USAGE" |grep -q [0-9] && if [ "$USAGE" -gt "$MAX" ]; then
|
|
|
|
echo "`uname -n` ($IP) $DISK is at ${USAGE}% capacity" | mail -s "[diskspace] $DISK explodiert gleich" space@admin.systemausfall.org
|
2006-04-07 16:41:51 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|