[root@ 17_johnson]# cat /usr/bin/DiskUsage
#!/bin/bash
#filesystems="/dev/sda1 /dev/sda2 /dev/sda5"
filesystems="/data /log /app /backup /home /"
for fs in $filesystems
do
size=`df -k $fs |grep $fs |awk '{ print $3 }'`
if [ $size -le 2500000 ] ;then
# mail -b "URGENT: Low disk space for $fs ($size)"
echo "$fs ($size) URGENT" | mail -s "Alert: Disk Usage for Ishy $fs ($size) " shrikant.lokhande@example.com
echo "URGENT"
break
fi
if [ $size -le 5000000 ] ;then
# mail -b "WARNING: Low disk space for $fs ($size)
echo "$fs ($size) WARNING" | mail -s "Alert: Disk Usage for Ishy(LOW) $fs ($size) " shrikant.lokhande@example.com
echo "WRANING"
fi
done
#!/bin/bash
#filesystems="/dev/sda1 /dev/sda2 /dev/sda5"
filesystems="/data /log /app /backup /home /"
for fs in $filesystems
do
size=`df -k $fs |grep $fs |awk '{ print $3 }'`
if [ $size -le 2500000 ] ;then
# mail -b "URGENT: Low disk space for $fs ($size)"
echo "$fs ($size) URGENT" | mail -s "Alert: Disk Usage for Ishy $fs ($size) " shrikant.lokhande@example.com
echo "URGENT"
break
fi
if [ $size -le 5000000 ] ;then
# mail -b "WARNING: Low disk space for $fs ($size)
echo "$fs ($size) WARNING" | mail -s "Alert: Disk Usage for Ishy(LOW) $fs ($size) " shrikant.lokhande@example.com
echo "WRANING"
fi
done
1 comments:
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city
Post a Comment