Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix3.0 email alarm configuration

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

After we have built the Zabbix server and created the monitoring items and triggers, how to use the mailbox to achieve the alarm function? This article uses mail as a mail sending tool.

How to install and configure mailboxes is described below.

If you don't say much, just do it! We are divided into two steps: the first step is to install the mail mail sending tool, and the second step is to configure the Zabbix server to send alarm mail

I. mail installation and setup

Install mail support

Yum install postfixsystemctl start postfixsystemctl enable postfix

Authentication: ss-lntp

Install the email tool mail

Yum-y install bzip2 openssl openssl-devel wget patch gcc-c++cd / optwget http://nchc.dl.sourceforge.net/project/heirloom/heirloom-mailx/12.4/mailx-12.4.tar.bz2tar jxvf mailx-12.4.tar.bz2 # decompress cd mailx-12.4 # enter the directory wget http://www.linuxfromscratch.org/patches/blfs/7.6/mailx-12.4-openssl_1.0.0_build_fix-1.patch # download the patch pack patch -Np1-I mailx-12.4-openssl_1.0.0_build_fix-1.patch # patch make # compile make install UCBINSTALL=/usr/bin/install # install ln-s / usr/local/bin/mailx / bin/mail # create mailx to mail soft connection ln-s / etc/nail.rc / etc/mail.rc # create mailx configuration file soft connection whereis mailx # View installation path mailx- V # View version information

Edit sender and mail server information

Vi / etc/nail.rc add the following configuration file: set from=xxxxxx0@163.com # set default sender set smtp=smtp.163.com # smtp server set smtp-auth-user=xxxxxx@163.com # set authentication sender mailbox set smtp-auth-password=12345678 # login password set smtp-auth=login # allow login (mailbox information is modified according to your own situation! )

Restart-- > systemctl restart postfix

Send mail test

Echo "message content" | mail-s "message subject" xxxxxx@163 (recipient's email address)

For example:

Echo "--Hello Word! -" | mail-s "Message" xxxxxx@163.com

Detailed explanation of mail command parameters

-b: specify the address of the recipient of the BCC copy

-c: specify the address of the recipient of the copy

-f: read messages in the specified mail file

-I: do not display messages sent by the terminal

-I: use interactive mode

-n: the settings in the mail.rc file are not used when the program is in use

-N: when reading a message, the title of the message is not displayed

-s: specify the subject of the message

-u: read the mail of the specified user

-v: when executed, detailed information is displayed.

II. Zabbix server configuration

Configure the zabbix profile vim / etc/zabbix/zabbix_server.conf

AlertScriptsPath=/usr/lib/zabbix/alertscripts # email delivery script is placed under the configuration path

Content of the script:

[root@zabbix_server alertscripts] # cat sendmail.sh #! / bin/shmessages= `echo $3 | tr'\ n''\ n' 'subject= `echo $2 | tr'\ n' 'echo "${messages}" | mail-s "${subject}" $1 > > / tmp/sendmail.log 2 > & 1

Restart the zabbix service

Configure zabbix graphical-manage-alarm media type-create media type in the upper right corner-pass in three parameters

{ALERT.SENDTO}-address of the recipient

{ALERT.SUBJECT}-topic

{ALERT.MESSAGE}-body

Configure recipient and user permissions-manage-user-alarm medium-Select sendemail.sh script and enter the recipient's email address

Add permissions-manage-user groups-Select Zabbix administrator group

Click permissions-add monitored groups

Configure-Action-Edit email delivery operation

Configure send action and send message format

Alarm host: {HOSTNAME1}

Alarm address: {IPADDRESS}

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}

Configure-Action-Action

Modification duration is 60 seconds

Modify step 3, which means that 3 actions are triggered

Select user Admin

Choose to send only to sendEmail.sh

Click Update

Restore the main body of information:

Alarm host: {TRIGGER.NAME}

Alarm address: {IPADDRESS}

Alarm time: {EVENT.DATE} {EVENT.TIME}

Current status: {TRIGGER.STATUS}

Alarm level: {TRIGGER.SEVERITY}

Alarm URL: {TRIGGER.URL}

Item values:

1. {ITEM.NAME1} ({HOST.NAME1}: {ITEM.KEY1}): {ITEM.VALUE1}

2. {ITEM.NAME2} ({HOST.NAME2}: {ITEM.KEY2}): {ITEM.VALUE2}

3. {ITEM.NAME3} ({HOST.NAME3}: {ITEM.KEY3}): {ITEM.VALUE3}

Configuration complete!

Click on the report-- Action Log-- to view the status of email delivery!

Summary

The above is the Zabbix3.0 email alarm configuration introduced by the editor to you. I hope it will be helpful to you. If you have any questions, please leave a message for me, and the editor will reply you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report