Linux-Zabbix email alert settings, linux-zabbix alert

Source: Internet
Author: User

Linux-Zabbix email alert settings, linux-zabbix alert
System Environment: Ubuntu 16.04 on Zabbix Server

Install sendmail

sudo apt install sendmail

Test email sending

Echo "text! "| Mail-s title XXX@qq.com

After successful installation, continue to install the email server. Heirloom-mailx in Ubuntu

Apt-get install heirloom-mailx
# The yum install mailx // CentOS is mailx. After CentOS is installed, you need to change the configuration file. For details, see

After installation, configure the. sh sending 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 the mail sending script messages = 'echo $3 | tr' \ r \ n' subject = 'echo $2 | tr' \ r \ N' '\ n' echo "$ {messages}" | mail-s "$ {subject}" $1>/tmp/sendmail. log 2> & 1

Add executable permissions

chown zabbix.zabbix /etc/zabbix/alertscripts/sendmail.shchmod +x /etc/zabbix/alertscripts/sendmail.sh

Test script

Su-zabbix/etc/zabbix/alertscripts/sendmail. sh xxxx@qq.com "test mail title" "test mail content" // check whether calls can be performed by zabbix users
Next, configure the web server.

1. Configure --- enable the action. In this step, you can edit the content and format of the sent email.

2. Manage --- alarm media type-create media type, for example:

Add three script parameters:

{ALERT. SENDTO}, {ALERT. SUBJECT}, {ALERT. MESSAGE}

The three parameters correspond to the three parameters required by the sendEmail. sh Script: Recipient address, topic, and details.

3. Set the email address for receiving alerts-enable

Whether the test is successful. Enter
/etc/init.d/zabbix_agentd stop

Check whether an alarm email is received normally! Complete.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.