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

feat(alert): Add collector fail alert #117

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/prometheus_alert_rules/general.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
groups:
- name: HardwareObserver
rules:
- alert: CollectorFailed
expr: '{__name__=~"(.*)_collector_failed"} == 1'
for: 0m
labels:
severity: warning
rgildein marked this conversation as resolved.
Show resolved Hide resolved
annotations:
summary: Controller fetch failed. (instance {{ $labels.instance }})
sudeephb marked this conversation as resolved.
Show resolved Hide resolved
description: |
Collrector fetch failed. Please reach out to hardware-observer maintainers.
sudeephb marked this conversation as resolved.
Show resolved Hide resolved
LABELS = {{ $labels }}
35 changes: 35 additions & 0 deletions tests/unit/test_alert_rules/test_general.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
rule_files:
- ../../../src/prometheus_alert_rules/general.yaml

evaluation_interval: 1m

tests:
- interval: 1m
input_series:
- series: ipmidcmicollector_collector_failed{instance="ubuntu-99", collector="IPMIDCMICollector"}
values: '1x15'
- series: ipmiselcollector_collector_failed{instance="ubuntu-99", collector="IPMISELCollector"}
values: '1x15'

alert_rule_test:
- eval_time: 0m
alertname: CollectorFailed
exp_alerts:
- exp_labels:
severity: warning
instance: ubuntu-99
collector: IPMIDCMICollector
exp_annotations:
summary: Controller fetch failed. (instance ubuntu-99)
description: |
Collrector fetch failed. Please reach out to hardware-observer maintainers.
LABELS = map[__name__:ipmidcmicollector_collector_failed collector:IPMIDCMICollector instance:ubuntu-99]
- exp_labels:
severity: warning
instance: ubuntu-99
collector: IPMISELCollector
exp_annotations:
summary: Controller fetch failed. (instance ubuntu-99)
description: |
Collrector fetch failed. Please reach out to hardware-observer maintainers.
LABELS = map[__name__:ipmiselcollector_collector_failed collector:IPMISELCollector instance:ubuntu-99]