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 override multiple alerts with same name #12

Open
varac opened this issue Aug 26, 2022 · 0 comments
Open

Can't override multiple alerts with same name #12

varac opened this issue Aug 26, 2022 · 0 comments

Comments

@varac
Copy link

varac commented Aug 26, 2022

I'm trying to override two alerts with the same name (see https://awesome-prometheus-alerts.grep.to/rules#rule-blackbox-1-5 and https://awesome-prometheus-alerts.grep.to/rules#rule-blackbox-1-6).
I don't know how I would approach/deal with this anyhow, but I still wanted to report this issue, don't know if there could be a solution to it.

❯ cat bug-multiple-alerts-with-same-name.rules 
---
groups:
- name: multiple_alerts_with_same_name
  rules:

  - alert: BlackboxSslCertificateWillExpireSoon
    expr: 'probe_ssl_earliest_cert_expiry - time() < 86400 * 30'
    for: 0m
    labels:
      severity: warning
    annotations:
      summary: Blackbox SSL certificate will expire soon (instance {{ $labels.instance
        }})
      description: "SSL certificate expires in 30 days\n  VALUE = {{ $value }}\n \
        \ LABELS = {{ $labels }}"

  - alert: BlackboxSslCertificateWillExpireSoon
    expr: 'probe_ssl_earliest_cert_expiry - time() < 86400 * 3'
    for: 0m
    labels:
      severity: critical
    annotations:
      summary: Blackbox SSL certificate will expire soon (instance {{ $labels.instance
        }})
      description: "SSL certificate expires in 3 days\n  VALUE = {{ $value }}\n  LABELS\
        \ = {{ $labels }}"

  - alert: BlackboxSslCertificateWillExpireSoon_override
    override: ["BlackboxSslCertificateWillExpireSoon"]
    expr: 'probe_ssl_earliest_cert_expiry - time() < 86400 * 3'
    for: 5m
    labels:
      severity: critical
    annotations:
      summary: Blackbox SSL certificate will expire soon (instance {{ $labels.instance
        }})
      description: "SSL certificate expires in 3 days\n  VALUE = {{ $value }}\n  LABELS\
        \ = {{ $labels }}"
❯ prometheus-alert-overrider bug-multiple-alerts-with-same-name.rules
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.extractFilterExpressions({0xc0000f8380, 0x33})
	/home/varac/projects/monitoring/prometheus/alerts/prometheus-alert-overrider/main.go:119 +0x68
main.NegateFilterExpression({0xc0000f8380?, 0x517214?})
	/home/varac/projects/monitoring/prometheus/alerts/prometheus-alert-overrider/main.go:144 +0x25
main.AlertFile.Override({{0xc0000a0a80?, 0xc00004c670?, 0xc000093f70?}}, {{0xc0000b4120, 0x2d}, {0x0, 0x0}, {0xc0000f8380, 0x33}, {0xc0000c86b0, ...}, ...})
	/home/varac/projects/monitoring/prometheus/alerts/prometheus-alert-overrider/main.go:92 +0x2ae
main.main()
	/home/varac/projects/monitoring/prometheus/alerts/prometheus-alert-overrider/main.go:224 +0x4a5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant