disk space monitoring

#!/bin/sh
# Monitor disk space
pastas="[email protected]"
proc=85
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do

usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $proc ]; then
echo "Lack of disk space \"$partition ($usep%)\" $(hostname) date $(date)" |
mail -s "Important! Disck space $usep" $pastas
fi
done

Leave a Reply

Your email address will not be published. Required fields are marked *