Configure any email client, such as mutt to send emails on linux and use simple script to generate alerts of critical/warning free space.

----------
#!/bin/sh
fs=`mount|egrep '^/dev'|grep -iv cdrom| awk '{print $3}'`
typeset -i thresh="85"  >>Percentage
typeset -i warn="95"   >> Percentage
for i in $fs
do
    skip=0
    typeset -i used=`df -k $i|tail -1|awk '{print $5}'|cut -d "%" -f 1`
    if [ "$used" -ge "$warn" ]; then
        echo "CRITICAL: filesystem $i is $used% full"
mutt  -s "Critical Disk Utilization" abcd@xyz.com >> send an email to abcz@xyz.com
    fi
    if [ "$used" -ge "$thresh" -a "$used" -le "$warn" ]; then
        echo "WARNING: filesystem $i is $used %full"
mutt  -s "Warning Disk Utilization" abcd@xyz.com >> send an email to abcz@xyz.com
    fi
done
----------

0 comments :

Post a Comment