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

Can't add labels for alert rules at group level #4139

Closed
ahrtr opened this Issue May 4, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@ahrtr
Copy link

ahrtr commented May 4, 2018

We defined lots of alert rules, which can be classified as a couple of groups. We need to send alerts of each group to a different target (pagerDuty service). So the plan is to add a different label for each group, i.e., group1, group2, group3, etc.

But currently we have to add the label to each alert rule. It would be better if we can set the label to the group instead of each alert rule. What we want is something as below,

groups:
- name: alert rules for group1
  labels:
      service: group1
  rules:

  - alert: group1_rule1
    expr: xxxxxx
    for: 10m
    labels:
      severity: critical
    annotations:
      description: ""
      summary: xxxxxx

  - alert: group1_rule2
    expr: xxxxxx
    for: 10m
    labels:
      severity: critical
    annotations:
      description: ""
      summary: xxxxxx

@ahrtr ahrtr changed the title Can't add a label for a rule group Can't add labels for alert rules at group level May 4, 2018

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 4, 2018

You need to add it to each alert specifically, we generally try to avoid having more than one way to do things and this would also interact poorly with recording rules. You can always use the templating features of your configuration management system if you find that this is too noisy.

@lijieki126

This comment has been minimized.

Copy link

lijieki126 commented Nov 7, 2018

@ahrtr How do you solve this problem?
“You need to add it to each alert specifically”,how to do this?

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