标签:告警系统邮件引擎
一、告警系统邮件引擎cp /usr/lib/zabbix/alertscripts/mail.py /usr/local/sbin/mon/mail/mail.py
cd /usr/local/sbin/mon/mail
vim mail.sh
log=$2
t_s=`date +%s`
t_s2=`date -d "2 hours ago" +%s`
if [ ! -f /tmp/$log ]
then
echo $t_s2 > /tmp/$log
fi
t_s2=`tail -1 /tmp/$log|awk ‘{print $1}‘`
echo $t_s >> /tmp/$log
v=$[$t_s-$t_s2]
echo $v
if [ $v -gt 3600 ]
then
../mail/mail.py $1 $2 "$3"
echo "0" > /tmp/$log.txt
else
if [ ! -f /tmp/$log.txt ]
then
echo "0" > /tmp/$log.txt
fi
nu=`cat /tmp/$log.txt`
nu2=$[$nu+1]
echo $nu2 > /tmp/$log.txt
if [ $nu2 -gt 10 ]
then
../mail/mail.py $1 "trouble continue 10 min $2 " "$3"
echo "0" > /tmp/$log.txt
fi
fi
cd /usr/local/sbin/mon/bin/
sh -x main.sh
标签:告警系统邮件引擎
原文地址:http://blog.51cto.com/13569831/2125320