prometheus icon indicating copy to clipboard operation
prometheus copied to clipboard

Can Prometheus support label-based alarm priority capabilities?

Open xinyu7git opened this issue 7 years ago • 1 comments

Proposal

Use case. Why is this important? If you have lots job to monitor. You can set a general alarm rule like:

- alert: HighCPU
    expr: cpu_usage > 50
    for: 5m
    annotations:
      summary: High CPU

but there is a job that needs special treatment, so you can add a new alert rule

- alert: HighCPU
    expr: cpu_usage > 50
    for: 5m
    annotations:
      summary: High CPU
- alert: HighCPU For job1
    expr: cpu_usage{job="job1"} > 80
    for: 5m
    annotations:
      summary: High CPU

if the cpu_usage of job1 is 60, the first alert rule "HighCPU" will still triggered.

Of course you can avoid it by modifying the "HighCPU" rule:

- alert: HighCPU
    expr: cpu_usage{job!="job1"} > 50
    for: 5m
    annotations:
      summary: High CPU
- alert: HighCPU For job1
    expr: cpu_usage{job="job1"} > 80
    for: 5m
    annotations:
      summary: High CPU

But what if there are more jobs that need special treatment? And If you remove the specially treated job, you also need to delete the blocking rule in the general rule.

Can Prometheus support label-based alarm priority capabilities?

For cpu_usage > 50 and cpu_usage{job="job1"} > 80, cpu_usage{job="job1"} has a higher alarm priority, For cpu_usage{job="job1"} > 80 and cpu_usage{job="job1", service="mysql"} > 85, cpu_usage{job="job1", service="mysql"} > 85 has a higer alarm priority.
Label-Value pairs Must be a subset relationship.

xinyu7git avatar Sep 10 '19 03:09 xinyu7git

See https://www.robustperception.io/using-time-series-as-alert-thresholds

I'm closing it for now. If you have further questions, please use our user mailing list, which you can also search.

simonpasquier avatar Sep 10 '19 08:09 simonpasquier