Zabbix 4.2 configure email Alerts
This article refers to bilibili up main https://www.bilibili.com/video/av47893710
1. Get the authorization password to log in to the 163 mailbox and click Settings.
Select POP3/SMTP/IMAP
Click the client authorization password
Click to open
two。 To add the prerequisite for sending zabbix mail, you need to close postfix [root@localhost] # systemctl stop postfix.service [root@localhost ~] # systemctl disable postfix.service install mailx [root @ localhost ~] # yum-y install mailx to change the mail.rc configuration file [root@localhost ~] # vim / etc/mail.rc on the last line to join the set form= mailbox account, set smtp=smtp.163.comset smtp-auth-user= mailbox account, set smtp-auth-password= mailbox client authorization password set smtp-auth=login to send a test email.
[root@localhost ~] # echo "Test" | mailx-s "zabbix Test" email account
The mailbox has obtained the test message.
Add the mail alert script [root@localhost ~] # cd / usr/lib/zabbix/alertscripts/ [root@localhost alertscripts] # vim mail.shrunk to the / usr/lib/zabbix/alertscripts/ directory to add the mail alert script [root@localhost alertscripts] # / mail.sh linuxywzz@163.com "zabbix test2"Test" 163echo "$SENT_CONTENT" | mailx-s "$SENT_SUBJECT" $SENT_TO authorization email mail.sh test whether [root@localhost alertscripts] #. / mail.sh linuxywzz@163.com "zabbix test2"Test" 163mailbox receives the test email
3. Add mail alarm media
Add email alarm media to users
Create an alarm action
Title and message content: default title of alarm operation: fault {TRIGGER.STATUS}, server: {HOSTNAME1} occurred: {TRIGGER.NAME} fault! Message content: alarm host: {HOSTNAME1} alarm time: {EVENT.DATE} {EVENT.TIME} alarm level: {TRIGGER.SEVERITY} alarm message: {TRIGGER.NAME} alarm item: {TRIGGER.KEY1} question details: {ITEM.NAME}: {ITEM.VALUE} current status: {TRIGGER.STATUS}: {ITEM.VALUE1} event ID: {EVENT.ID} recovery operation default title: restore {TRIGGER.STATUS} Server: {HOSTNAME1}: {TRIGGER.NAME} has been restored! Message content: alarm host: {HOSTNAME1} alarm time: {EVENT.DATE} {EVENT.TIME} failure duration: {EVENT.AGE} recovery time: {EVENT.RECOVERY.TIME} alarm level: {TRIGGER.SEVERITY} alarm information: {TRIGGER.NAME} alarm item: {TRIGGER.KEY1} question details: {ITEM.NAME}: {ITEM.VALUE} current status: {TRIGGER.STATUS}: {ITEM.VALUE1} event ID: {EVENT.ID} 4. Prepare for completion, change triggers, trigger email alarms
Log in to email 163 and see the alarm message.
I hope I can follow my official account and study together.