下载 sendEmail 


          http://www.ttlsa.com/linux/use-sendemail/

          http://www.ttlsa.com/zabbix/zabbix-custom-alertscripts/



sendEmail下载地址:http://caspian.dotconf.net/menu/Software/SendEmail/

wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz 

 tar -xzvf sendEmail-v1.56.tar.gz //解压后就可以使用了

 mv sendEmail-v1.56/sendEmail /usr/local/bin/


测试发邮件


/usr/local/bin/sendEmail -f [email protected] -t [email protected]  -s smtp.exmail.qq.com -u "邮件主题" -o message-content-type=html -o message-charset=utf8  -xu [email protected] -xp 123 -m "邮箱内容" 


媒介配置

点击administrator->media types->create media types

zabbix 邮件报警_第1张图片


配置AlertScriptsPath


mkdir /usr/local/zabbix-2.2.1/alertscripts

cat /usr/local/zabbix-2.2.1/etc/zabbix_server.conf| grep -i aler

AlertScriptsPath=/usr/local/zabbix-2.2.1/alertscripts


脚本编写


cd /usr/local/zabbix-2.2.1/alertscripts

#!/bin/sh

 to=$1

 subject=$2

 body=$3

/usr/local/bin/sendEmail -f [email protected] -t "$to" -s smtp.163.com -u "$subject" -o message-content-type=html -o message-charset=utf8 -xu [email protected] -xp123456 -m "$body" 2>>/tmp/22.log


记得加执行权限



配置Actions


zabbix 邮件报警_第2张图片


用户媒介


给用户指定媒介:

*点击Administration→Users->打开用户属性表单->在Media tab点击Add

zabbix 邮件报警_第3张图片


大部分邮箱都限制了固定IP企业邮箱才可以发出去的


http://wiki.110monitor.com/integration/zabbix-auto.html

http://www.ttlsa.com/zabbix/zabbix-onealert-msg-compress/


http://wiki.110monitor.com/qa/zabbix-auto-ChangeAPP.html