In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Environment:
OS:centos7.4
Zabbix Server:zabbix_server (Zabbix) 4.0.14
1. Mail configuration
Confirm that the mail sending tool is installed
Yum install mailx-y
Configure / etc/mail.rc, and add configuration items to the tail:
# Add mail-conf by yuhuanghuiset from=stupidking123@163.comset smtp=smtp.163.comset smtp-auth-user=123456set smtp-auth-password=password1 # authorization code set smtp-auth=loginset ssl-verify=ignore
Mail authorization
Chown-R zabbix:zabbix / etc/mail.rc
Note: the mail cannot be sent because the file is not authorized here. The action log in zabbix Web shows that it has been sent, but in fact, the mailbox has not been received.
In addition to activating the SMTP service, you also need to activate the authorization code to log in. The above configuration is no longer the login password, but the authorization code. Choose 163 mailbox to send here.
two。 Write a script for sending mail
Cd / usr/lib/zabbix/alertscripts
Vim mail-send.sh
#! / bin/bashmessages= `echo $3 | tr'\ r\ n'\ n' `subject= `echo $2 | tr'\ r\ n''\ n' `echo "${messages}" | mailx-s "${subject}" $1 > > / tmp/sendmail.log 2 > & 1
Modify permissions
Chown-R zabbix:zabbix mail-send.sh
Chomod + x mail-send.sh
Chown-R zabbix:zabbix / tmp/sendmail.log
Test delivery:
Su-zabbix switching zabbix user
Sh / usr/lib/zabbix/alertscripts/mail-send.sh abc@xxx.com "zabbix test mail"test"
Check the mailbox to receive the email, indicating that the script was sent successfully.
3. Configure web on zabbix page
Manage-> alarm Media Type-> create Media Type
Add three script parameters:
{ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE}
The script name must be the same as the script name configured with / usr/lib/zabbix/alertscripts on zabbix server.
4. Create a user
Manage-> users
Management-> users-> alarm media
5. Create an action configuration
Configure-> Action-> Action
Create email sending action and configure trigger condition: trigger warning degree is greater than or equal to warning
Configure-> Action-> Action
Default title:
Fault {TRIGGER.STATUS}, server name: {HOSTNAME1} occurred: {TRIGGER.NAME} failure!
Message content:
Alarm host: {HOSTNAME} alarm host IP address: {HOST.IP} alarm time: {EVENT.DATE} {EVENT.TIME} alarm level: {TRIGGER.SEVERITY} alarm information: {TRIGGER.NAME} alarm item: {TRIGGER.KEY1} problem details: {ITEM.NAME}: {ITEM.VALUE} current status: {TRIGGER.STATUS}: {ITEM.VALUE1} event ID: {EVENT.ID}
Configure-> Action-> restore
Default title
Restore {TRIGGER.STATUS}, server name: {HOSTNAME1}: {TRIGGER.NAME} has been restored!
Message content
Alarm host: {HOSTNAME} alarm host IP address: {HOST.IP} alarm time: {EVENT.DATE} {EVENT.TIME} alarm level: {TRIGGER.SEVERITY} alarm information: {TRIGGER.NAME} alarm item: {TRIGGER.KEY1} problem details: {ITEM.NAME}: {ITEM.VALUE} current status: {TRIGGER.STATUS}: {ITEM.VALUE1} event ID: {EVENT.ID}
Verify that the action created is enabled:
6. test
Turn off the zabbix-agnet service of the client server
Systemctl stop zabbix-agent.service shuts down the service
Wait for 5 minutes to check in the email.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.