Prometheus配置钉钉告警

[复制链接]

826

主题

826

帖子

446

积分

中级会员

Rank: 3Rank: 3

积分
446
分享到:
发表于 2022-7-28 11:01:59 | 显示全部楼层 |阅读模式
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=$PATHGOROOT/binGOPATH/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=send" &编译alertmanager配置文件global: ?resolve_timeout: 5m ?smtp_smarthost: 'smtp.qiye.aliyun.com:465' ?smtp_from: '[email protected]' ?smtp_auth_username: '[email protected]' ?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: '[email protected]' ?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=send run -d --restart always -p 8060:8060 timonwong/prometheus-webhook-dingtalk:v0.3.0 --ding.profile="webhook1=send src="https://cache.yisu.com/upload/information/20200309/33/61148.jpg" alt="rometheus配置钉钉告警">

遇到说明1.不知道我报警设置的有问题,还是程序有问题,钉钉发一次就报错了还需要继续改进。参考文档将钉钉接入 Prometheus AlertManager WebHook

配置钉钉告警
docker镜像
二进制程序文件
通过webhook推送钉钉
cetnos7 安装go环境
云专线_海外IDC http://www.vecloud.com/

使用高级回帖 (可批量传图、插入视频等)快速回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则   Ctrl + Enter 快速发布  

发帖时请遵守我国法律,网站会将有关你发帖内容、时间以及发帖IP地址等记录保留,只要接到合法请求,即会将信息提供给有关政府机构。
快速回复 返回顶部 返回列表