1. Install and test mail service
Centos's own mail service is postfix, postfix is MTA (mail transfer agent), mailx is MUA (mail user agent), mailx calls postmail to send mail to users.
Install and set to boot up.
Note: The mail service occupies port 25, confirm that it is open!
yum install postfix mailx
systemctl status postfix.service
systemctl enable postfix.service
rpm -qa | grep postfix #查看版本信息
mailx -V #查看mailx版本
echo "test mail" |mail -s "test mail" xxx@163.com #测试发送邮件
Two, configure the Zabbix server email alarm
1. Set the alarm media
Name: Emial
SMTP server: Fill in the address or host name where the mail service is installed (remember to modify the hosts file). This machine is used here.
SMTP HELO: also fill in the mail server address.
SMTP email: the name of the outgoing mailbox, you can modify it yourself. Sending emails using the default localhost.localdomain will be blocked as spam.
Already used: check
2, set up the Zabbix user alarm email address
3. Set the action of Zabbix to trigger the alarm
Three, test Zabbix alarm
Shut down the Zabbix client service
systemctl stop zabbix_agentd
Check the mailbox of [email protected] and you will receive an alarm email
. After recovery, you will also receive an alarm.