zabbix_QQ邮件告警部署(待续。。。。。。)

安装sendmail

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

yum -y install perl-Net-SSLeay perl-IO-Socket-SSL

tar xf sendEmail-v1.56.tar.gz -C /usr/local/

cd /usr/local/sendEmail-v1.56/

/bin/cp -ra sendEmail /usr/local/bin/

chmod +x /usr/local/bin/sendEmail

登录qq邮箱进行设置:

测试邮件发送

cd /usr/local/sendEmail-v1.56/

sendEmail -f 1450595701@qq.com -t 1450595701@qq.com -u "zabbix_server" -s smtp.qq.com -o message-content-type=html -o tls=no message-charset=utf8 -xu 1450595701@qq.com -xp zoyswlqfhxhricdf

 -m "邮件发送成功"

编写QQ邮件平台报警脚本

cd /usr/local/zabbix/share/zabbix/alertscripts

vim sendmail.sh

#!/bin/bash

# author:wei

to=$1

subject=$2

body=$3

[email protected]

smtp=smtp.qq.com

passwd=zoyswlqfhxhricdf #qq邮箱的兑换码

/usr/local/bin/sendEmail -f "$from" -t "$to" -s "$smtp" -u "$subject" -o message-content-type=html -o tls=no message-charset=utf8 -xu "$from" -xp "$passwd" -m "$body"

chmod +x sendmail.sh

chown zabbix.zabbix sendmail.sh

测试邮件发送

sh sendmail.sh [email protected] "hello world" "新.一天"

 

猜你喜欢

转载自www.cnblogs.com/creater-wei/p/10014130.html