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

Zabbix email alarm-sendmail

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Using several email alarm software, I still feel that sendmail is timely and stable.

1. Configure on the zabbix server server:

1.1 the storage path of the sending mail script:

123 [root@zabbix_server etc] # cat zabbix_server.conf | grep alertscripts # AlertScriptsPath=$ {datadir} / zabbix/alertscripts AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts

1.2 download and installation of sendmail software:

I use SendEmail, if the mail that comes with your system can send a successful email with your own, you can refer to my other article, Centos5.x & Centos6.x uses the mail command to send email and how to forge the sender: http://pynliu.blog.51cto.com/5027391/1608916.

SendEmail download address; http://caspian.dotconf.net/menu/Software/SendEmail/#download

Unzip it and put it in any directory. I put it in the / usr/local/zabbix/share/zabbix/alertscripts directory.

12 [root@zabbix_server alertscripts] # lssendEmail-v1.56

1.3 the alarm message of zabbix will pass three variables, all of which are configured in the zabbix_web interface. They are: recipient email, alarm subject and alarm content, and $1 $2 $3 in the script

Write a script sendmail and give executable permission

12345678 [root@zabbix_server alertscripts] # chmod axix sendmail.sh [root@zabbix_server alertscripts] # cat sendmail.sh #! / bin/bash# $1 sendmail address# $2 sendmail subject# $3 contentSENDMAIL=/usr/local/zabbix/share/zabbix/alertscripts/sendEmail-v1.56/sendEmail$SENDMAIL-f LangFang@zabbix.com-t "$1"-s xxx.benguo.cn-u "$2"-m "$3" > > / dev/null

Note: LangFang@zabbix is the sender's mailbox, is a fake sender, can be self-defined as long as it is not identified as a spam mailbox.

Explanation:

-f indicates the sender's mailbox

-t indicates the recipient's mailbox

(to receive and send mail, try not to use the same mailbox account, it is easy to make mistakes)

-s represents the domain name or ip of the SMTP server

-u indicates the subject of the message

-xu represents the user name authenticated by SMTP

-xp represents the password authenticated by SMTP (note that this password seems to be limited, for example, if I use dumb5neyland, it cannot be correctly identified)

-m represents the content of the message

2. The following is the configuration on zabbix web:

2.1 configure "alarm Media Type" to create a media type:

Make sure that the name of the script is the same as that written on the server.

2.2 user Settings:

The warning degree is the severity of the trigger.

Third, create actions

Fourth, after adding, the alarm will be realized according to the trigger.

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

Database

Wechat

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

12
Report