1. Install sudo apt install sendmail
2. Test Send mail:
echo "Body! " | mail-s title [email protected]
3 . Continue to install mail server after successful. Ubuntu System for HEIRLOOM-MAILX
Apt-get Install HEIRLOOM-MAILX
#yum install MAILX//centos for Mailx,centos after installation also need to change the configuration file see
4. start configuration after installation . sh Send Script
Mkdir/etc/zabbix/alertscripts
VIM/ETC/ZABBIX/ZABBIX_SERVER.CONF//Modify alert scripts to the following path
Alertscriptspath=/etc/zabbix/alertscripts
/etc/init.d/zabbix_server Restart//restart Zabbix server
#vim/etc/zabbix/alertscripts/sendmail.sh//write a mail send script
Messages= ' echo $ | Tr ' \ n ' \ n '
Subject= ' echo | Tr ' \ r \ n ' \ n ' echo ' ${messages} ' | Mail-s "${subject}" $ >>/tmp/sendmail.log 2>&1
Chown zabbix.zabbix/etc/zabbix/alertscripts/sendmail.sh
chmod +x/etc/zabbix/alertscripts/sendmail.sh
5, You can test the script, look at the line or not.
Su-zabbix
cd/etc/zabbix/alertscripts/
Sh sendmail.sh [email protected] "test message header" "Test message Content"//See if the call can be performed by Zabbix user
6, configuration ---action enabled; In this step, you can edit the contents and format of the sent message.
7. Management --- alarm media types - Create media types such as:
Add 3 script parameters:
{ALERT. Sendto},{alert. SUBJECT},{ALERT. MESSAGE}
3 parameters that correspond to the 3 parameters required by the sendemail.sh script : Recipient address, subject, details
8, Click on the management ---"User-----" admin can see the alarm media.
8 . Click on the alarm media when you come in and click Add.
8. add the appropriate alarm media
One, manage ------ user groups --------Zabbix administrators
Ubuntu under zaibbix3.2 Alarm Setup