#! /bin/bash
# chetan.muneshwar@gmail.com
# script to get disk space status on multiple instances and alert Admin
bulk_data=(`df -Ph | grep -r '/' | awk '{ printf "%s-%s-%s-%s ",$3,$4,$5,$6 }'`)
for (( i = 0 ; i < ${#bulk_data[*]}; i++ ))
do
threshold="`echo ${bulk_data[i]}|cut -d "-" -f 3|cut -d "%" -f 1` "
if [ $threshold -le 0 ] ; then
shm_val="`echo ${bulk_data[i]}|grep -r 'shm'`"
if [ "$shm_val" == "" ] ; then
echo "SERVER ${bulk_data[i]} " | mail -s " Disk vol fuLL ISHY-SERVER " chetan.muneshwar@labs.net -c shrikant.lokhande@labs.net
else
echo ""
fi
else
if [ $threshold -le 90 ] ;then
echo ""
else
echo "SERVER ${bulk_data[i]} " | mail -s " Disk vol warning ISHY-SERVER " chetan.muneshwar@labs.net -c shrikant.lokhande@labs.net
fi
fi
done
Finally add cronjob : * * * * * /usr/bin/DISK
No comments:
Post a Comment