Quote:
ALERT=90
df -H /dev/sda3 | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $ALERT ]; then
echo "Running out of space \"$partition ($usep%) used\" on $(hostname) as on $(date)" |
mail -s "Alert: Almost out of disk space $(hostname)" user@domain.com
fi
done
|
This is the script I use to email me when a filesystem goes above 90% used. I set it as a cron job for every 30 minutes. Although I have since replaced most of my server monitoring with nagios and it has a disk usage check