ADMIN="tyagi.ankur07@gmail.com"
# set alert level 90% is default
ALERT=80
df -HP | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 }' | while read output;
do
#echo $output
usep=$(echo $output | awk '{ print $1 }' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
#echo "usep=$usep"
if [ $usep -ge $ALERT ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
mailx -s "Alert: Almost out of disk space on `hostname` $usep" $ADMIN
fi
done
# set alert level 90% is default
ALERT=80
df -HP | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 }' | while read output;
do
#echo $output
usep=$(echo $output | awk '{ print $1 }' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
#echo "usep=$usep"
if [ $usep -ge $ALERT ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
mailx -s "Alert: Almost out of disk space on `hostname` $usep" $ADMIN
fi
done