Construction "if then else" in alert rules alertmanager(prometheus)
1
vote
0
answers
786
views
Right now I have two rules for "Warning" and "Critical" alerts. Is it possible to combine them somehow, so as not to produce entities?
- 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"
An example of how I present it:
- 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"
Asked by Alexander Kolesnik
(11 rep)
May 25, 2022, 10:46 AM
Last activity: May 25, 2022, 10:47 AM
Last activity: May 25, 2022, 10:47 AM