Prometheus配置钉钉告警
发表于:2024-10-06 作者:千家信息网编辑
千家信息网最后更新 2024年10月06日,Prometheus配置钉钉告警获取钉钉token配置钉钉webhook 钉钉通过机器人提供了一个webhook接口,但是呢钉钉机器人对文件格式有严格要求,所以必须通过特定的格式转换,才能发送给你钉
千家信息网最后更新 2024年10月06日Prometheus配置钉钉告警
Prometheus配置钉钉告警
获取钉钉token
配置钉钉webhook
钉钉通过机器人提供了一个webhook接口,但是呢钉钉机器人对文件格式有严格要求,所以必须通过特定的格式转换,才能发送给你钉钉的机器人。有人已经写了转换插件,我是个拿来主义者(主要是自己不会搞,先跑起来再说),那就直接用吧。
命令行方式
- 安装go语言
wget -c https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gztar -C /usr/local/ -zxvf go1.8.3.linux-amd64.tar.gz mkdir -p /home/gocodecat << EOF >> /etc/profileexport GOROOT=/usr/local/go #设置为go安装的路径export GOPATH=/home/gocode #默认安装包的路径export PATH=$PATH:$GOROOT/bin:$GOPATH/binEOFsource /etc/profile
- 编译钉钉插件
cd /home/gocode/mkdir -p src/github.com/timonwong/cd /home/gocode/src/github.com/timonwong/git clone https://github.com/timonwong/prometheus-webhook-dingtalk.gitmakeln -s /home/gocode/src/github.com/timonwong/prometheus-webhook-dingtalk/prometheus-webhook-dingtalk /usr/local/bin/prometheus-webhook-dingtalk
- 启动插件
nohup prometheus-webhook-dingtalk --ding.profile="webhook1=https://oapi.dingtalk.com/robot/send?access_token=xxxxx" &
- 编译alertmanager配置文件
global: resolve_timeout: 5m smtp_smarthost: 'smtp.qiye.aliyun.com:465' smtp_from: 'sxxx@yy.com.com' smtp_auth_username: 'sxxx@yy.com.com' smtp_auth_password: 'xxx' smtp_require_tls: falseroute: group_by: [cluster,] group_wait: 10s group_interval: 10s repeat_interval: 1h receiver: 'web.hook'receivers:- name: 'web.hook' email_configs: - to: 'sxxx@yy.com.com' webhook_configs: - url: 'http://localhost:8060/dingtalk/webhook1/send' send_resolved: false
- 结果截图
- 遇到问题说明
1.如果编译出错,可能是go版本问题。2. 原始代码go编译好像写死了目录,如果出错,可以按照我写的去做。(具体不得而知,go语言不熟)
docker方式
- 直接执行docker程序
docker run -d --restart always -p 8060:8060 timonwong/prometheus-webhook-dingtalk:master --ding.profile="webhook1=https://oapi.dingtalk.com/robot/send?access_token=XXXXXX"
- 编译altermanager配置文件
docker run -d --restart always -p 8060:8060 timonwong/prometheus-webhook-dingtalk:v0.3.0 --ding.profile="webhook1=https://oapi.dingtalk.com/robot/send?access_token=XXXXXX"
- 结果截图
- 遇到说明
1.不知道我报警设置的有问题,还是程序有问题,钉钉发一次就报错了还需要继续改进。
参考文档
将钉钉接入 Prometheus AlertManager WebHook
配置钉钉告警
docker镜像
二进制程序文件
通过webhook推送钉钉
cetnos7 安装go环境
配置
编译
文件
问题
插件
机器
机器人
程序
截图
方式
格式
结果
语言
路径
原始
不得而知
主义
主义者
二进制
代码
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
csol可以安装配件的服务器
河南前端软件开发收费报价表
软件开发卡通图
软件开发要求越来越高
服务器内存占用过高自动停止
山东视频会议软件开发
dell服务器snmp电源
全球价值链和增加值数据库
违反网络安全法第48条的事件
计算机软件开发大脑壳
泰拉瑞亚怎么加入朋友的服务器
网络安全交易知识
新时代网络安全研究所
刘尊全网络安全
找网络技术人员追钱
网络安全工作责任制具体措施
中速云网络技术
服务器数据安全软件
浏览器 服务器模式简称
csmar数据库外网账号
垃圾英雄联盟服务器卡顿
先进应用软件开发
数据库中的父类和子类erd图
用服务器搭建虚拟电脑
镇江网络安全主题教育
MySQL数据库固定的结构
sql满足所有数据库
无锡光学仿真软件开发
软件开发是淘宝单吗
视频网络技术