下载 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 ady.han@libkr.com -t ady.han@libkr.com -s smtp.exmail.qq.com -u "邮件主题" -o message-content-type=html -o message-charset=utf8 -xu ady.han@libkr.com -xp 123 -m "邮箱内容"
媒介配置
点击administrator->media types->create media types
配置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 13262209921@163.com -t "$to" -s smtp.163.com -u "$subject" -o message-content-type=html -o message-charset=utf8 -xu 13262209921@163.com -xp123456 -m "$body" 2>>/tmp/22.log
记得加执行权限
配置Actions
用户媒介
给用户指定媒介:
*点击Administration→Users->打开用户属性表单->在Media tab点击Add
大部分邮箱都限制了固定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
转载于:https://blog.51cto.com/7456193/1783342