首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >将通知从Prometheus alertmanager发送到Google聊天室

将通知从Prometheus alertmanager发送到Google聊天室
EN

Stack Overflow用户
提问于 2021-02-23 21:16:11
回答 1查看 1.2K关注 0票数 0

我们最近开始在我们的组织中使用Google Chat,因此我们需要从Prometheus-Alertmanager向Google聊天室发送警报。下面是我为Google chat配置的alertmanager

代码语言:javascript
代码运行次数:0
运行
复制
receiver:
    - name: 'gchat-receiver'
      webhook_configs:
        - url: "https://chat.googleapis.com/v1/spaces/AAAArcv5Snw/messages?key=KEY&token=TOKEN"
          send_resolved: false

当我们实现上面的配置时,我们的alertmanager日志中会出现以下错误:

代码语言:javascript
代码运行次数:0
运行
复制
level=error ts=2021-02-23T06:23:43.931Z caller=dispatch.go:309 component=dispatcher msg="Notify for alerts failed" num_alerts=2 err="gchat-receiver/webhook[0]: notify retry canceled due to unrecoverable error after 1 attempts: unexpected status code 400: https://chat.googleapis.com/v1/spaces/AAAArcv5Snw/messages?key=KEY&token=TOKEN"
level=error ts=2021-02-23T06:23:43.971Z caller=dispatch.go:309 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="gchat-receiver/webhook[0]: notify retry canceled due to unrecoverable error after 1 attempts: unexpected status code 400: https://chat.googleapis.com/v1/spaces/AAAArcv5Snw/messages?key=KEY&token=TOKEN"
level=error ts=2021-02-23T06:23:43.976Z caller=dispatch.go:309 component=dispatcher msg="Notify for alerts failed" num_alerts=21 err="gchat-receiver/webhook[0]: notify retry canceled due to unrecoverable error after 1 attempts: unexpected status code 400: https://chat.googleapis.com/v1/spaces/AAAArcv5Snw/messages?key=KEY&token=TOKEN"
level=error ts=2021-02-23T06:23:43.994Z caller=dispatch.go:309 component=dispatcher msg="Notify for alerts failed" num_alerts=2 err="gchat-receiver/webhook[0]: notify retry canceled due to unrecoverable error after 1 attempts: unexpected status code 400: https://chat.googleapis.com/v1/spaces/AAAArcv5Snw/messages?key=KEY&token=TOKEN"

在这方面的任何帮助或指导都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2021-02-24 00:29:47

这是因为Google Chat希望将特定JSON有效负载模式发布到webhook地址,而默认Alertmanager payload与其不匹配,因此会得到HTTP 400响应: bad request。

您可能需要在两者之间放置一个自定义应用程序,以便将JSON转换为Google Chat可接受的格式。Github中已经有一些repos也符合这个通用标准。(例如calert)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66333868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档