Zabbix achieve ultra-detailed steps to configure e-mail alerts

Message the alarm mode is implemented here using a normal can send and receive messages over the Internet email account (eg: *** @ 163.com), zabbix provided by the server, the implementation may send an alarm message when a failure occurs to the specified E-mail
implementation steps:

1, the installation tool to send e-mail mailx
Zabbix achieve ultra-detailed steps to configure e-mail alerts
can be found in the version information of the installation was successful
Zabbix achieve ultra-detailed steps to configure e-mail alerts
2, modify the configuration file
and finally add the following /etc/mail.rc file and restart zabbix-server service:
Zabbix achieve ultra-detailed steps to configure e-mail alerts
Smtp-auth-way acquisition passwordd see below :
Zabbix achieve ultra-detailed steps to configure e-mail alerts
3, modify the web end of the
Zabbix achieve ultra-detailed steps to configure e-mail alerts
three parameters correspond script parameters need sendmail.sh script inside: the recipient's address, subject, details.
Zabbix achieve ultra-detailed steps to configure e-mail alerts
Configure the user to Admin, for example, because the Admin user in the user group Zabbix administrators inside, so make sure this group for all the host group has administrative privileges:
Zabbix achieve ultra-detailed steps to configure e-mail alerts

Zabbix achieve ultra-detailed steps to configure e-mail alerts
Zabbix achieve ultra-detailed steps to configure e-mail alerts
Configuration and operation of the alarm associated with the operation of the mail together
Zabbix achieve ultra-detailed steps to configure e-mail alerts
modify the alarm content:
Zabbix achieve ultra-detailed steps to configure e-mail alerts
Default Title:
{TRIGGER.STATUS}: {TRIGGER.NAME}
message content:

故障:{TRIGGER.STATUS},服务器:{HOSTNAME1}发生:{TRIGGER.NAME}故障!
告警主机:{HOSTNAME1},IP地址:{HOST.CONN}
告警时间:{EVENT.DATE}--{EVENT.TIME}
告警等级:{TRIGGER.SEVERITY}
告警信息:{TRIGGER.NAME}
告警项目:{TRIGGER.KEY1}
问题详情:{ITEM.NAME}:{ITEM.VALUE}
当前状态:{TRIGGER.STATUS}:{ITEM.VALUE1}
事件ID:{EVENT.ID}

Alarm resume content is changed a bit:
Zabbix achieve ultra-detailed steps to configure e-mail alerts

默认标题:
{TRIGGER.STATUS}: {TRIGGER.NAME}
消息内容:
恢复:{TRIGGER.STATUS},服务器:{TRIGGER.NAME} 已经恢复!   
 告警主机:{HOSTNAME1} ,IP地址:{HOST.CONN}
告警时间:{EVENT.DATE}---{EVENT.TIME}
恢复时间:{EVENT.DATE}---{EVENT.RECOVERY.TIME}
告警等级:{TRIGGER.SEVERITY}
告警信息:{TRIGGER.NAME}
告警项目:{TRIGGER.KEY1}
问题详情:{ITEM.NAME}:{ITEM.VALUE}
当前状态:{TRIGGER.STATUS}:{ITEM.VALUE1}
事件ID:{EVENT.ID}

Zabbix achieve ultra-detailed steps to configure e-mail alerts
Set the same recovery operations
Note: Steps 1-3: The default is 1-1, that is, from the beginning to the end of 1, the event of failure, on the implementation of the user or user group (above me sendmail.sh script sends an alarm message to your settings just add the Admin user), if the fault lasted an hour but did not resolve, it is performed only once, if it is 1-0,0 for infinite, the transmission interval is the step duration 60s, it will send 60 e-mail, apparently It is unreasonable.
Web-side configuration is completed
4, script writing sendmail.sh
note your script alarms set in zabbix-server configuration file storage path:
Zabbix achieve ultra-detailed steps to configure e-mail alerts
I chose the default here, did not make changes, so sendmail.sh script must be placed in this path following
script as follows (remember + X permissions):
Zabbix achieve ultra-detailed steps to configure e-mail alerts

#!/bin/sh
export.UTF-8
FILE=/tmp/mailtmp.txt
echo "$3" >$FILE
dos2unix -k $FILE
/bin/mail -s "$2" $1 < $FILE
touch /tmp/mailtmp.txt
chown zabbix.zabbix /tmp/mailtmp.txt

5, validation testing
stopped zabbix-agent in zabbix server side, see if you can receive e-mail alerts
Zabbix achieve ultra-detailed steps to configure e-mail alerts
Zabbix achieve ultra-detailed steps to configure e-mail alerts
to restore e-mail:
Zabbix achieve ultra-detailed steps to configure e-mail alerts
zabbix e-mail alerts have been completed
ending .....

Guess you like

Origin blog.51cto.com/11954248/2476875