Two different thresholds with condition in one alert rule

35 views
Skip to first unread message

neel patel

unread,
Sep 9, 2020, 6:53:08 AM9/9/20
to Prometheus Users
Hi Team,

I have defined below the alert rule which says if disk usage exceeds 80%, it should raise the critical alert. Can I define in the same rule file if disk usage is between > 60 % & < 80% should be considered as a warning ? Or do I have to define another alert rule for the warning level ?

```
  # Disk usage in percentage
  - alert: DiskUsageInPercentage
    expr: disk_usage_percentage > 80
    for: 10m
    labels:
      severity: critical
    annotations:
      summary: "Disk usage in percentage on {{ $labels.instance }}"
      description: "{{ $labels.instance }} has disk usage percentage above threshold value of 80% (current value: {{ $value }}%)"
```

Let us know in case of any query. Help will be appreciated.

Thanks,
Neel

Matthias Rampke

unread,
Sep 9, 2020, 7:40:46 AM9/9/20
to neel patel, Prometheus Users
Define another alert rule. It is okay to give it the same name, as long as the labels are definitely distinct.

/MR

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAPTvBttLZ7CcmoRTTpU%2BbGeHLQJDut6dTEmCVz54KhOjNCtZjQ%40mail.gmail.com.

Brian Candler

unread,
Sep 9, 2020, 8:53:20 AM9/9/20
to Prometheus Users
You create another alert.  You can set a warning alert for just > 60, and you can create an inhibit rule in alertmanager so that a "critical" alert suppresses an otherwise identical "warning" alert.
Reply all
Reply to author
Forward
0 new messages