learning of zabbix 3.2.3 邮件报警

4.zabbix发送邮件报警


1.下载 sendEmail-v1.56.tar.gz ,解压即可

2.媒介配置

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

learning of zabbix 3.2.3 邮件报警_第1张图片


3.配置AlertScriptsPath

[root@lys1 ~]# vim /etc/zabbix/zabbix_server.conf
AlertScriptsPath=/etc/zabbix/alertscripts

4.配置邮件脚本 vi /etc/zabbix/alertscripts/sendmail.sh
#!/bin/bash
SMTP_server='smtp.163.com'
username='[email protected]'
password='smtp的授权码'
from_email_address='[email protected]'
to_email_address="$1"               #1
message_subject_utf8="$2"           #2
message_body_utf8="$3"              #3

message_subject_gb2312=`iconv -t GB2312 -f UTF-8 << EOF
$message_subject_utf8
EOF`
[ $? -eq 0 ] && message_subject="$message_subject_gb2312" || message_subject="$message_subject_utf8"
#  change to GB2312
message_body_gb2312=`iconv -t GB2312 -f UTF-8 << EOF
$message_body_utf8
EOF`
[ $? -eq 0 ] && message_body="$message_body_gb2312" || message_body="$message_body_utf8"
# send email
sendEmail='/usr/bin/sendEmail'
$sendEmail -s "$SMTP_server" -xu "$username" -xp "$password" -f "$from_email_address" -t "$to_email_address" -u "$message_subject" -m "$message_body" -o message-content-type=text -o message-charset=gb2312
echo "`date +"%F %T"` send to $to_email_address" >> /tmp/send.log




5.为用户指定媒介

learning of zabbix 3.2.3 邮件报警_第2张图片

6.设置触发的action


资源感谢:http://www.cnblogs.com/liuyisai/p/5904467.html

你可能感兴趣的:(zabbix)