zabbix-mail alert notification

surroundings
System: CentOS7

Zabbix版本:Zabbix3.4.4

yum -y install sendmail (sendmail as the mail service)

yum -y install mailx (mailx mailbox transmission means)

systemctl start sendmail 

systemctl stop postfix

vim /etc/mail.rc

Whether the test message can be issued

echo “”1111111“” |mail -s "ceshi"   [email protected]

(1111111 message body ceshi theme [email protected] for the recipient)

Send Mail script editor

yum -y install dos2unix

In / usr / lib / zabbix / alertscirpts increase a script messages sent

Modify the contents of the script message is sent:

#! / bin / bash
# export.UTF-8 ### sent solve Chinese become garbled question
FILE = / tmp / mailtmp.txt
echo "$ 3"> $ FILE
dos2unix -k $ ### solved FILE mail data becomes a problem attachments.
/ bin / mail -s "$ 2 " $ 1 <$ FILE

Create a temporary file and authorized

touch /tmp/mailtmp.txt

chown zabbix.zabbix /tmp/mailtmp.txt

The above three parameters are passed from a web page received over:

$1:收件人邮箱地址;
$2:邮件标题;
$3:邮件内容

chmod 777 scripts
chown zabbix.zabbix script

Configuration web page
1, create a media type

Management -> Alarm media type -> Create Media Type

Click on the icon filled out by the update, you will see the type of alarm media named Email just created type 

2, to alert users to add media
here for Admin user as an example Management -> Users -> click Admin


2. Create action

 
































 

Guess you like

Origin www.cnblogs.com/jdwy24/p/12394244.html