我的 Prometheus 警报管理器中的时间戳值未发送到火箭聊天 webhook

问题描述

我从 prometheus 向 Rocketchat webhook 发送警报。 这是我的警报规则之一的配置:

- alert: HighcpuLoad
  expr: 100 - (avg by (instance,group,host) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 81
  for: 5m
  labels:
    severity: warning
  annotations:
    timestamp: "{{ with query "time()" }}{{ . | first | value | humanizeTimestamp }}{{ end }}"
    description: "Check cpu load on host {{ $labels.host }}"
    firing_text: "cpu load on host {{ $labels.host }} is > 80%\n  VALUE = {{ humanize $value }}"
    resolved_text: "High cpu load on host {{ $labels.host }} is resolved"

我在注解中定义的所有参数(时间戳、描述、fire_text 和resolution_text)都被发送到alertmanager。但是我没有在 Rocketchat 警报中收到“时间戳”。

这是警报管理器 UI 中的警报: enter image description here

这是出现在 Rocketchat webhook 中的警报消息: enter image description here

如您所见,警报消息中未显示时间戳。

如何让它出现在 webhook 警报消息中?

顺便说一下,我想发送满足条件的点的日期和时间。例如,在我的表达式中,如果我的 cpu 负载在 2020-12-24 08:00:00 达到 80% 以上,它会等待 5 分钟然后发送警报,如果警报管理器队列有其他警报要发送,则需要其他一些分钟将警报发送到 Rocketchat webhook(超过 5 分钟)。 我需要准确发送问题出现的时间点(在本例中为 2020-12-24 08:00:00 而不是 2020-12-24 08:05:00 或 08:06:00)。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)