![警报规则中构造“if then else”alertmanager(prometheus)](https://linux22.com/image/206293/%E8%AD%A6%E6%8A%A5%E8%A7%84%E5%88%99%E4%B8%AD%E6%9E%84%E9%80%A0%E2%80%9Cif%20then%20else%E2%80%9Dalertmanager(prometheus).png)
现在我有两个“警告”和“严重”警报规则。是否有可能以某种方式将它们组合起来,以免产生实体?
- 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"