Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmalert: add template variable to hold the "for:" alert rule value #995

Open
rcowham opened this issue Jun 26, 2024 · 2 comments
Open

vmalert: add template variable to hold the "for:" alert rule value #995

rcowham opened this issue Jun 26, 2024 · 2 comments
Labels
question Further information is requested

Comments

@rcowham
Copy link

rcowham commented Jun 26, 2024

It would be nice to be able to include

  - alert: InstanceDown
    expr: up == 0
    for: 5m
    labels:
      severity: page
    annotations:
      description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.'
      summary: 'Instance {{ $labels.instance }} down'

E.g. allow something like this:

      description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than {{ $for }}.'

Thoughts?

@f41gh7
Copy link
Collaborator

f41gh7 commented Jun 26, 2024

Hello, it should be already possible to use the value of for field from alerting rule, in this case it should be 5m.

For the actual firing state of alert, it's recommended to use value of StartsAt field at alertmanager

https://prometheus.io/docs/alerting/latest/notifications/#alert

@f41gh7 f41gh7 added the question Further information is requested label Jun 26, 2024
@f41gh7 f41gh7 closed this as completed Jul 4, 2024
@rcowham
Copy link
Author

rcowham commented Jul 4, 2024

Apologies - but at the link you gave I am not seeing "for" as an option. Should I raise it with prometheus guys?

@f41gh7 f41gh7 reopened this Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants