mirror of
https://github.com/hanzoai/metrics.git
synced 2026-10-30 20:03:39 +00:00
fix https://github.com/VictoriaMetrics/VictoriaMetrics/pull/9526, bug was introduced from **v1.114.0**. Please note, the rule execution failure should only happen if there is a bad template or duplicated alert(rare case), added a test case to cover the template. --------- Signed-off-by: hagen1778 <[email protected]> Co-authored-by: hagen1778 <[email protected]>
48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
groups:
|
|
- name: group1
|
|
rules:
|
|
- alert: InstanceDown
|
|
expr: up == 0
|
|
for: 5m
|
|
labels:
|
|
severity: page
|
|
annotations:
|
|
summary: "Instance {{ $labels.instance }} down"
|
|
description: "{{ $labels.instance }} of job {{ $labels.job }} in cluster {{ $externalLabels.cluster }} has been down for more than 5 minutes."
|
|
dashboard: '{{ $externalURL }}/d/dashboard?orgId=1'
|
|
- alert: AlwaysFiring
|
|
expr: 1
|
|
- alert: SameAlertNameWithDifferentGroup
|
|
expr: absent(test)
|
|
for: 1m
|
|
- alert: AlertWithTemplate
|
|
expr: test
|
|
annotations:
|
|
queryAnno: '{{ query "foo" | first | value }}'
|
|
|
|
- name: group2
|
|
rules:
|
|
- record: t1
|
|
expr: test
|
|
- record: job:test:count_over_time1m
|
|
expr: sum without(instance) (count_over_time(test[1m]))
|
|
- record: suquery_interval_test
|
|
expr: count_over_time(up[5m:])
|
|
|
|
- alert: SameAlertNameWithDifferentGroup
|
|
expr: absent(test)
|
|
for: 5m
|
|
|
|
- name: group3
|
|
rules:
|
|
- record: t2
|
|
expr: t1
|
|
|
|
- name: group4
|
|
rules:
|
|
- record: t3
|
|
expr: t1
|
|
|
|
- name: emptyGroup
|
|
rules: []
|