53 Star 350 Fork 126

feiyu563 / PrometheusAlert

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
conf-feishu.md 2.13 KB
一键复制 编辑 原始数据 按行查看 历史
jikun.zhang 提交于 2022-07-01 11:58 . 更新帮助文档目录结构“

PrometheusAlert全家桶飞书配置说明


飞书机器人目前支持V1和V2两个版本,区别在于地址的不同

V1地址:https://open.feishu.cn/open-apis/bot/hook​/​xxxxxxxxxxxxxxxxxx V2地址:https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx

开启飞书机器人v1

打开飞书,进入飞书群中,选择群设置-->群机器人-->添加机器人-->Custom Bot,可参下图:

fei

fei2

fei3

复制图中的Webhook地址,并填入PrometheusAlert配置文件app.conf中对应配置项即可。

开启飞书机器人v2

进入你的目标群组,打开会话设置,找到群机器人,并点击添加机器人。选择通知机器人,添加Custom Bot(自定义机器人)加入群聊。 fei4 为你的机器人输入一个合适的名字和描述,并选择添加。同时,你会获取该群组的 webhook 地址,格式如下。请妥善保存好此地址,避免泄露,恶意发送信息。 fei5 飞书V2接口的告警消息采用消息卡片消息模式,使用lark_md消息格式。 消息格式参考: https://open.feishu.cn/document/ukTMukTMukTM/uADOwUjLwgDM14CM4ATN

PS: 飞书机器人V2目前已经支持 @某人 ,使用该功能需要取得对应用户的飞书关联的Email邮箱地址。

飞书相关配置:

#---------------------↓webhook-----------------------
#是否开启飞书告警通道,可同时开始多个通道0为关闭,1为开启
open-feishu=1
#默认飞书机器人地址
fsurl=https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx

如何使用

以Prometheus配合自定义模板为例:

Prometheus配置参考:

global:
  resolve_timeout: 5m
route:
  group_by: ['instance']
  group_wait: 10m
  group_interval: 10s
  repeat_interval: 10m
  receiver: 'web.hook.prometheusalert'
receivers:
- name: 'web.hook.prometheusalert'
  webhook_configs:
  - url: 'http://[prometheusalert_url]:8080/prometheusalert?type=fs&tpl=prometheus-fs&fsurl=飞书机器人地址,飞书机器人地址2'
Go
1
https://gitee.com/feiyu563/PrometheusAlert.git
git@gitee.com:feiyu563/PrometheusAlert.git
feiyu563
PrometheusAlert
PrometheusAlert
master

搜索帮助