警报规则中构造“if then else”alertmanager(prometheus)

警报规则中构造“if then else”alertmanager(prometheus)

现在我有两个“警告”和“严重”警报规则。是否有可能以某种方式将它们组合起来,以免产生实体?

  - alert: Proxysql latency check
    expr: metric1 > 1
    for: 30s
    labels:
      severity: warning
      instance: "{{ $labels.node_name }}"
      label: name-channel
    annotations:
      summary: "Info"

  - alert: Proxysql latency check
    expr: metric1 > 5
    for: 30s
    labels:
      severity: critical
      instance: "{{ $labels.node_name }}"
      label: name-channel
    annotations:
      summary: "Info"

我如何呈现它的一个例子:

      - alert: Proxysql latency check
    expr: if metric1 > 1 then "Warning" else metric > 5 "Critical" 
    for: 30s
    labels:
      severity: warning | critical
      instance: "{{ $labels.node_name }}"
      label: name-channel
    annotations:
      summary: "Info"

相关内容