need Configuring DingTalk alarms in Zabbix is similar to configuring DingTalk alarms in Prometheus. However, Zabbix’s alerts through DingTalk are implemented through Python scripts. Prometheus is implemented through the binary package of DingTalk. For the settings of DingTalk, please refer to another blog post of mine (Configure DingTalk Alerts with Prometheus): https://knight.blog.csdn.net/article/details/105583741 We will now mainly explain the settings and implementation of Zabbix DingTalk Webhook Code Implementation vim /usr/local/zabbix/share/zabbix/alertscripts/dingding.py #!/usr/bin/env python #coding:utf-8 import requests,json,sys,os,datetime webhook="https://oapi.dingtalk.com/robot/send?access_token=6e5bcfee12bc6fa7f3c6bd16b7d6c333d86266cecadd3fe5e77a29cedae9f9" #Description: Here, change the value of the webhook of the robot you created to user=sys.argv[1] text=sys.argv[3] data={ "msgtype": "text", "text": { "content": text }, "at": { "atMobiles": [ user ], "isAtAll": False } } headers = {'Content-Type': 'application/json'} x=requests.post(url=webhook,data=json.dumps(data),headers=headers) if os.path.exists("/tmp/dingding.log"): f=open("/tmp/dingding.log","a+") else: f=open("/tmp/dingding.log","w+") f.write("\n"+"--"*30) if x.json()["errcode"] == 0: f.write("\n"+str(datetime.datetime.now())+" "+str(user)+" "+"Sent successfully"+"\n"+str(text)) f.close() else: f.write("\n"+str(datetime.datetime.now()) + " " + str(user) + " " + "Failed to send" + "\n" + str(text)) f.close() Execute it: chmod +x dingding.py # add execution permission python dingding.py ab "test" Let's see if DingTalk can receive the alarm (remember to add the server's public IP to the whitelist of DingTalk) The configuration of Zabbix is as follows: (1) Configure the alarm media type: Configuration--->Alarm media type, the script parameters are as follows: {ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE} The screenshots are as follows: (2) Configuration action Configure--->Action--->Create Action, and copy the "Operation" and recovery operation content of the WeChat alarm or email alarm. (3) Finally configure the user Configuration--->User--->Alarm Media, just add DingTalk. The recipient needs to write his or her own phone number. The configuration of Zabbix is complete. Let's take a look at the warning effect diagram Summarize This is the end of this article about Zabbix configuration DingTalk alarm. For more relevant Zabbix configuration DingTalk alarm content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: WeChat applet component development: Visual movie seat selection function
>>: mysql 8.0.18 mgr installation and its switching function
Be careful when listening for events that are tri...
Today's screen resolutions range from as smal...
Solution to Host 'xxxx' is not allowed to...
1. Execute SQL to view select @@session.sql_mode;...
Under the instructions of my leader, I took over ...
500 (Internal Server Error) The server encountere...
1. The difference between the command > and &g...
In fact, it is not difficult to build an Apache c...
A frame is a web page screen divided into several ...
When installing Tomcat in Docker, Tomcat may over...
1. Install the cross-system file transfer tool un...
routing vue-router4 keeps most of the API unchang...
Table of contents defineComponent overload functi...
This may be an issue that is easily overlooked. F...
Preface Many friends who have just come into cont...