In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article Xiaobian for you to introduce in detail "Centos7 how to solve the email content for xx.bin attachment problem", the content is detailed, the steps are clear, the details are handled properly, I hope that this "Centos7 how to solve email content for xx.bin attachment problem" article can help you solve doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.
1. Add monitoring linux hosts
1. Configure-host-create host
2. Fill in the information
3. Add a template
4. Check the status
Second, configure mailboxes
System environment:
[root@localhost ~] # cat / etc/redhat-release centos linux release 7.2.1511 (core)
1. Install the mail sending tool mailx
If other mail sending tools are installed, close the
Service sendmail stop # # shut down sendmailsystemctl disable sendmail.service # # disable boot sendmailservice postfix stop # # shut down postfixsystemctl disable postfix.service # # disable boot postfix [root @ localhost ~] # yum install mailx
2. Configure the zabbix server external mailbox and open the file vim / etc/mail.rc. If the mail.rc file is not available, create it manually, and then add the following:
[root@localhost ~] # vim / etc/mail.rc
Set sendcharsets=iso-8859-1 UTFMAE 8set from=xxx@163.comset smtp=smtp.163.com # 163Mailbox needs to open smtp authorization set smtp-auth-user=xxx@163.com # authentication user set smtp-auth-password=xxx # authentication password
3. Test email delivery
[root@localhost ~] # echo "zabbix test mail" | mail-s "zabbix" xxx@163.com
4. Write a script to send mail
1) install dos2unix conversion tool (solve the problem that the email sent is in the format of xx.bin attachment), (the directory name of 7.5.1804 will be changed) if the download link here fails, go to Ali's official website to find the corresponding file.
[root@localhost ~] # rpm-ivh https://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/packages/dos2unix-6.0.3-7.el7.x86_64.rpm
Get https://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/packages/dos2unix-6.0.3-7.el7.x86_64.rpm
Preparing. # # [100%]
Upgrading / installing...
1:dos2unix-6.0.3-7.el7 # # [100%]
Accept the email below, but the text cannot be displayed
2) modify the content of the email sending script
Why did we create this script under this path, which is configured in our zabbix_serber.conf file
Alertscriptspath=/usr/lib/zabbix/alertscripts
So you don't want to put this script in this directory, you need to modify the value of alertscriptspath in the server's configuration file.
[root@localhost ~] # vim / usr export.utf-8 export.utf-8 # solve the problem that the Chinese sent becomes garbled file=/tmp/mailtmp.txt echo "$3" > $file dos2unix-k $file # solves the problem that the content of the message sent becomes an attachment. / bin/mail-s "$2" $1 < $file
3) create a temporary file and authorize it. Make sure that your users have zabbix.
[root@localhost ~] # touch / tmp/mailtmp.txt [root@localhost ~] # chown zabbix.zabbix / tmp/mailtmp.txt
4) the above three parameters receive the information passed from the web page:
$1: recipient email address
$2: message title
$3: message content
5) add permissions to the script, otherwise the email will not be sent normally when the alarm occurs.
[root@localhost ~] # chmod 755 / usr/lib/zabbix/alertscripts/sendmail.sh
5. Manage-alarm media type-create media type
6. Fill in the content
Add the following three parameters, corresponding to the three parameters required by the sendmail.sh script: recipient address, topic, and details
{alert.sendto} {alert.subject} {alert.message}
If you do not add these three parameters in 3.0, an error will be reported. Since custom parameters are allowed in zabbix after 3.0, parameters will not be passed by default. Three parameters will be passed by default in 2.0, so an error will be reported if you do not write these three parameters in 3.0.
7. Add alarm media to users
8. Set alarm conditions: configure-Action-create Action
1) set conditions and names
2) enter the recipient (default information). The user is the recipient who has just been filled in, and the myemail is also newly created.
Fault alarm: {trigger.status}: {trigger.name}
Alarm host: {host.name}
Host address: {host.ip}
Alarm time: {event.date} {event.time}
Alarm level: {trigger.severity}
Alarm message: {trigger.name}
Question details: {item.name}: {item.value}
Event code: {event.id}
Explanation: the default step is 1-1, that is, from 1 to 1. Once the failure occurs, the sendemail.sh script is executed to send an alarm email to the admin user and the zabbix administrator group. If the fault lasts for 1 hour, it will only be sent once. If you change it to 1-0, it means there is no limit. The infinite send interval is the default duration of 60 seconds. Then 60 emails will be sent in an hour.
3) restore operation
Troubleshooting: {trigger.status}: {trigger.name}
Recovery host: {host.name}
Host address: {host.ip}
Recovery time: {event.date} {event.time}
Recovery level: {trigger.severity}
Recovery information: {trigger.name}
Question details: {item.name}: {item.value}
Event code: {event.id}
At this point, our email alarm configuration is complete, as long as the trigger we set triggers, it will automatically send me an alarm email.
9. Test email alarm
1) Open the trigger
2) you can change the critical value of the trigger in the monitoring of available memory in the template included with zabbix to greater than 20 to enter the template list.
After the change
3) modify the update time to make it detect faster
4) check the alarm
5) email confirmation
If there is a problem with sending email, restart the server and the zabbix-server and httpd services, and the client restart the zabbix-agent service.
Read this, the "Centos7 how to solve the email content for xx.bin attachment problem" article has been introduced, want to master the knowledge of this article still need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.
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.