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
1. Usage: (1) EXISTS usage select a.batchName,a.p...
Samba Overview Samba is a free software that impl...
When it comes to remote desktop connection to Lin...
I encountered mysql ERROR 1045 and spent a long t...
Today, this post lists some great examples of circ...
Mouse effects require the use of setTimeout to ge...
This article shares with you the Ubuntu server ve...
Recently, a system was deployed, using nginx as a...
Problem description: For example, the content of ...
question CSS fixed positioning position:fixed is ...
This article uses examples to illustrate the usag...
1. Download MySQL Archive (decompressed version) ...
1. Prepare the Java environment, jdk1.8 Check whe...
As shown below: name describe character varying(n...
Table of contents Example 1 Example 2 Example 3 E...