zabbix3.4搭建钉钉报警
2024-10-08 05:15:05
1.在钉钉群里添加一个自定义的机器
在设置说明中无需开启Outgoing机制
红色箭头指的信息很重要后面脚本会用到
2.脚本
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: aiker@gdedu.ml
# My blog http://m51cto.51cto.blog.com
import requests
import json
import sys
import os
headers = {'Content-Type': 'application/json;charset=utf-8'}
api_url = "https://oapi.dingtalk.com/robot/send?access_token=37e23308d1b84eb4ac34566e03c4c4e74bxxxxxxxxxxxxxx"
def msg(text):
json_text= {
"msgtype": "text",
"at": {
"atMobiles": [
"13xxxxxxx80"
],
"isAtAll": False
},
"text": {
"content": text
}
}
print requests.post(api_url,json.dumps(json_text),headers=headers).content
if __name__ == '__main__':
text = sys.argv[1]
msg(text)
chmod +x dingdingrobot.py
脚本测试,python2
python dingdingrobot.py 123
参考博客:https://blog.51cto.com/m51cto/2051945
最新文章
- ABP(现代ASP.NET样板开发框架)系列之21、ABP展现层——Javascript函数库
- 性能优化方法(Z)
- Java序列化格式详解
- SQL语句判断是否为今天或昨天
- ubuntu下添加/删除启动服务项
- ES6中的Class
- 通过Jmeter完成WebTours的性能测试
- 剑指offer系列54---数组中出现次数超过一半的数
- 65.OV7725图像倒置180度
- ggplot2 scale相关设置
- (转载)DBCP、C3P0、Proxool 、 BoneCP开源连接池的比较
- 通过tokenPlease()函数获取accessToken
- Java开发速度神器Lombok,Eclipse端安装使用教程
- A previous installation of Qt5 Visual Studio Add-in was detected. Please uninstall it before running this installer解决办法
- JQuery EasyUI 表单
- JavaScript中的事件冒泡?事件传播的解释
- 网络编程 -- RPC实现原理 -- RPC -- 迭代版本V2 -- 本地方法调用 整合 Spring
- hdu 2289 要二分的杯子
- gdb 小技巧
- In MySQL, a zero number equals any string
热门文章
- 021 Ceph关于too few PGs per OSD的问题
- 通过nginx搭建基于python的web环境
- 中小型企业级 IPS 部署
- Windows服务器管理--批量管理工具
- VisitorPattern(访问者模式)-----Java/.Net
- kubernetes基础——一文读懂k8s
- 简单了解linux内核
- 二、Spring Cloud之注册中心 Eureka
- OpenLayers4 隐藏(hide)Feature
- CS0656	缺少编译器要求的成员“Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create”