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
zabbix Zabbix ([`zæbiks]) is an enterprise-level ...
As shown in the figure: But when viewed under IE6...
Table of contents 1. Create a redis docker base i...
As you build and scale your Django applications, ...
The notepad program is implemented using the thre...
We often encounter this situation in front-end de...
Neo4j (one of the Nosql) is a high-performance gr...
engine Introduction Innodb engine The Innodb engi...
1. Use the following command to set the ssh passw...
Overview This article is a script for automatical...
This article shares the specific code of Vue to s...
Use JS to implement object-oriented methods to ac...
This article example shares the specific code of ...
This article shares the specific code of js to ac...
I logged into the backend to check the solution t...