zabbix发送钉钉报警

avatar
作者
筋斗云
阅读量:0

钉钉机器人

https://www.jianshu.com/p/3a376a0c0b50

python3 脚本

#!/usr/bin/env python3 # pip3 install requests import sys  import requests  keyword = "Zabbix"  #alarmSubject = sys.argv[1] #alarmMsg = sys.argv[2]  alarmMsg = sys.argv[1]  content = {     "msgtype": "text",     "text": {         "content": f"""{keyword}{alarmMsg} """     },     "at": {         # @ 所有人         "isAtAll": True     } }  headers = {"Content-Type": "application/json;charset=utf-8"}  url = "https://oapi.dingtalk.com/robot/send?access_token=自己钉钉的token"  r = requests.post(url=url,headers=headers,json=content) print(r.content)  

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!