标签:ifconf lin hang percent 报警 line eth war ddr
#!/bin/shdf -h|grep "^/dev/" >> list.txt
EOF
echo -e "\033[32m \033[0m"
sleep 2
WEEK=date +%u
TIME=date
while read line
do
IP_ADDR=ifconfig eth1|grep "Bcast"|awk ‘{print $2}‘|awk -F: ‘{print $2}‘
D_NAME=echo $line|awk ‘{print $1,$NF"分区"}‘
D_TOTAL=echo $line|awk ‘{print $2}‘
D_AVAIL=echo $line|awk ‘{print $4}‘
D_PERCENT=echo $line|awk ‘{print $5}‘|sed ‘s/%//g‘
if [ "$D_PERCENT" -ge 50 ];then
cat >email.txt <<EOF
*EMAIL*****
通知类型:告警
服务:Disk Monitor
主机:$IP_ADDR
状态:告警
日期/时间:
echo "周$WEEK $TIME"
额外信息:
CRITICAL - DISK MONITOR:$D_NAME Used more than ${D_PERCENT}%
EOF
echo -e "\033[32mthe $D_NAME has been used for more than ${D_PERCENT}%,please check.....\033[0m"
mail -s "$D_NAME warning" allen.zhang@ddty.com.cn < email.txt
fi
done <list.txt
echo -e "\033[32m---------------------------------------------\033[0m"
echo "Done."
标签:ifconf lin hang percent 报警 line eth war ddr
原文地址:https://blog.51cto.com/1009516/2425814