How to get value of "for" duration from alerting rule?

13 views
Skip to first unread message

Zahar Celac

unread,
Jun 18, 2020, 3:06:14 PM6/18/20
to Prometheus Users
Hello!

Let's take alert example from from official doc:

# Alert for any instance that is unreachable for >5 minutes.
 
- alert: InstanceDown
    expr
: up == 0
   
for: 5m
    labels
:
      severity
: page
    annotations
:
      summary
: "Instance {{ $labels.instance }} down"
      description
: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."


Is it possible to get value from "for" clause (in this case ti will be "5m") so we can use it further in annotation section?

For exaple let's call it {{ $for_duraton }} :

description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than {{ $for_duration }}."
Reply all
Reply to author
Forward
0 new messages