小编kin*_*sch的帖子

Prometheus 的 HTML 警报/规则视图中的换行符

我有几个相当长的普罗米修斯警报规则。在我的编辑器中,我设法在规则表达式中添加换行符(请参阅行 expr),并|在开头添加 a :

- alert: IF_Critical
  annotations:
    description: The service on {{ $labels.route }} at {{ $labels.application }}is critical and has not received any timestamp in the last 60 minutes.
    summary: Service State is critical.
  expr: |
    (
      (camel_route_last_exchange_failure_timestamp > camel_route_last_exchange_completed_timestamp
    or
      camel_route_up == 0)
    or
     (time() - round(camel_route_last_exchange_completed_timestamp/1000) > 3600
    and
    (
      time() - round(camel_route_last_exchange_failure_timestamp/1000) > 3600
    and
      round(camel_route_last_exchange_failure_timestamp/1000) != 0
    ))
Run Code Online (Sandbox Code Playgroud)

然而,当查看 Prometheus 的规则和警报的 HTML 概述时,这些换行符消失了,取而代之的是表达式只是一行非常长的行。见下图:

Prometheus HTML 长规则

因此,提出以下问题:

  1. 是否可以在 HTML 概述中应用可见的换行符?

  2. 此外,当普罗米修斯规则的正则表达式(例如)route=~"ABC1|DEF1|GHI1|...ABC9|DEF9|GHI9|" …

regex line-breaks prometheus prometheus-alertmanager

5
推荐指数
0
解决办法
1585
查看次数