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

Zabbix4.0 configuration email alarm detailed procedure (with figure)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Install mail

[root@zabbix alertscripts] # yum install mailx-y

2. Edit the configuration file and add it on the last line

[root@zabbix alertscripts] # vim / etc/mail.rc

Set bsdcompat

Set sendcharsets=iso-8859-1 UTFMUF 8

Set from= mailbox

Set smtp=smtp://smtp.exmail.qq.com

Set smtp-auth-user= mailbox

Set smtp-auth-password= mailbox password

Set smtp-auth=login

3. Test whether the email is sent normally.

[root@zabbix alertscripts] # echo "zabbix test mail" | mail-s "zabbix" mailbox

4. Write an email script

[root@zabbix alertscripts] # cd / usr/lib/zabbix/alertscripts

[root@zabbix alertscripts] # vi mailx.sh

#! / bin/bash

# send mail

Messages=echo $3 | tr'\ r\ n'\ n'

Subject=echo $2 | tr'\ r\ n'\ n'

Echo "${messages}" | mail-s "${subject}" $1 > > / tmp/mailx.log 2 > & 1

5. Modify permissions

Touch / tmp/mailx.log

Chown-R zabbix.zabbix / tmp/mailx.log

Chmod + x / usr/lib/zabbix/alertscripts/mailx.sh

Chown-R zabbix.zabbix / usr/lib/zabbix/

6. Test script to send email

[root@zabbix alertscripts] # echo "hello world" | mail-s "testmail" your email address

7. Configure web on zabbix page

Add three script parameters

{ALERT.SENDTO}

{ALERT.SUBJECT}

{ALERT.MESSAGE}

8. User configuration

9. Configure actions

Fault {TRIGGER.STATUS}, server name: {HOSTNAME1} occurred: {TRIGGER.NAME} failure!

Alarm host: {HOSTNAME}

Alarm host IP address: {HOST.IP}

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}

Restore {TRIGGER.STATUS}, server name: {HOSTNAME1}: {TRIGGER.NAME} has been restored!

Alarm host: {HOSTNAME}

Alarm host IP address: {HOST.IP}

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}

10. Complete the test

Test the content of the message sent

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