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

Active alerts don't take into account templated labels #4169

Closed
FreGalle opened this Issue May 17, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@FreGalle
Copy link

FreGalle commented May 17, 2018

Bug Report

What did you do?

I'm using the following alert, note the dynamic severity label:

- alert: DiskUsageHigh
    expr: (1 - node_filesystem_avail{fstype!="rootfs",mountpoint!="",mountpoint!~"/(run|var).*"} / node_filesystem_size) * 100 > 85
    labels:
      severity: '{{ if gt $value 90.0 }}critical{{ else }}warning{{ end }}'
    annotations:
      summary: 'Disk usage threshold reached'
      description: 'Disk usage of device {{ $labels.device }} on {{ $labels.instance }} (mounted at {{ $labels.mountpoint }}) is at {{ $value|humanize }}%'

What did you expect to see?

I would expect to see the severity label change as soon as this alert's value reaches 90. It doesn't, which I think can be attributed to the way in which active alerts are checked and updated.

In addition to the alert's value and annotations, wouldn't it make sense to also replace its labels to account for the possibly dynamic rule labels?

This used to work pre-v2.

What did you see instead? Under which circumstances?

The alert kept its warning severity label and never escalated to the proper receivers configured to act on critical alerts.

Environment

  • Prometheus version:
prometheus, version 2.2.1 (branch: HEAD, revision: bc6058c81272a8d938c05e75607371284236aadc)
  build user:       root@149e5b3f0829
  build date:       20180314-14:15:45
  go version:       go1.10
  • Alertmanager version:
alertmanager, version 0.14.0 (branch: HEAD, revision: 30af4d051b37ce817ea7e35b56c57a0e2ec9dbb0)
  build user:       root@37b6a49ebba9
  build date:       20180213-08:16:42
  go version:       go1.9.2
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 17, 2018

@FreGalle

This comment has been minimized.

Copy link
Author

FreGalle commented May 17, 2018

Ok, would it make sense to include this information in the documentation on alerting rules in addition to saying they can be templated. The latter seems to imply no guidelines.

That being said, I thought this was a clean way to keep the alert definitions concise without any duplication.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 17, 2018

That being said, I thought this was a clean way to keep the alert definitions concise without any duplication.

There is no safe way to write this alert without duplication. This is a bug in any case, we're using the pre-expansion labels in the hash.

@shubheksha

This comment has been minimized.

Copy link
Contributor

shubheksha commented Jun 19, 2018

I'm gonna take a stab at this!

@csmarchbanks

This comment has been minimized.

Copy link
Contributor

csmarchbanks commented Aug 13, 2018

@shubheksha Are you still planning to work on this? If not I would like to pick it up.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.