mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-20 15:36:31 +01:00
1911320c86
Co-authored-by: hagen1778 <roman@victoriametrics.com>
105 lines
2.7 KiB
YAML
105 lines
2.7 KiB
YAML
rule_files:
|
|
- rules.yaml
|
|
|
|
evaluation_interval: 1m
|
|
group_eval_order: ["group4", "group2", "group3"]
|
|
|
|
tests:
|
|
- interval: 1m
|
|
name: "basic test"
|
|
input_series:
|
|
- series: "test"
|
|
values: "_x5 1x5 _ stale"
|
|
|
|
alert_rule_test:
|
|
- eval_time: 1m
|
|
groupname: group1
|
|
alertname: SameAlertNameWithDifferentGroup
|
|
exp_alerts:
|
|
- {}
|
|
- eval_time: 1m
|
|
groupname: group2
|
|
alertname: SameAlertNameWithDifferentGroup
|
|
exp_alerts: []
|
|
- eval_time: 150s
|
|
groupname: group1
|
|
alertname: SameAlertNameWithDifferentGroup
|
|
exp_alerts:
|
|
- {}
|
|
- eval_time: 6m
|
|
groupname: group1
|
|
alertname: SameAlertNameWithDifferentGroup
|
|
exp_alerts: []
|
|
|
|
metricsql_expr_test:
|
|
- expr: test
|
|
eval_time: 11m
|
|
exp_samples:
|
|
- labels: '{__name__="test"}'
|
|
value: 1
|
|
- expr: test
|
|
eval_time: 12m
|
|
exp_samples: []
|
|
|
|
- interval: 1m
|
|
name: "basic test2"
|
|
input_series:
|
|
- series: 'up{job="vmagent1", instance="localhost:9090"}'
|
|
values: "0+0x1440"
|
|
- series: "test"
|
|
values: "0+1x1440"
|
|
|
|
metricsql_expr_test:
|
|
- expr: count(ALERTS) by (alertgroup, alertname, alertstate)
|
|
eval_time: 4m
|
|
exp_samples:
|
|
- labels: '{alertgroup="group1", alertname="AlwaysFiring", alertstate="firing"}'
|
|
value: 1
|
|
- labels: '{alertgroup="group1", alertname="InstanceDown", alertstate="pending"}'
|
|
value: 1
|
|
- expr: t1
|
|
eval_time: 4m
|
|
exp_samples:
|
|
- value: 4
|
|
labels: '{__name__="t1", datacenter="dc-123"}'
|
|
- expr: t2
|
|
eval_time: 4m
|
|
exp_samples:
|
|
- value: 4
|
|
labels: '{__name__="t2", datacenter="dc-123"}'
|
|
- expr: t3
|
|
eval_time: 4m
|
|
exp_samples:
|
|
# t3 is 3 instead of 4 cause it's rules3 is evaluated before rules1
|
|
- value: 3
|
|
labels: '{__name__="t3", datacenter="dc-123"}'
|
|
|
|
alert_rule_test:
|
|
- eval_time: 10m
|
|
groupname: group1
|
|
alertname: InstanceDown
|
|
exp_alerts:
|
|
- exp_labels:
|
|
job: vmagent1
|
|
severity: page
|
|
instance: localhost:9090
|
|
datacenter: dc-123
|
|
exp_annotations:
|
|
summary: "Instance localhost:9090 down"
|
|
description: "localhost:9090 of job vmagent1 has been down for more than 5 minutes."
|
|
|
|
- eval_time: 0
|
|
groupname: group1
|
|
alertname: AlwaysFiring
|
|
exp_alerts:
|
|
- exp_labels:
|
|
datacenter: dc-123
|
|
|
|
- eval_time: 0
|
|
groupname: alerts
|
|
alertname: InstanceDown
|
|
exp_alerts: []
|
|
|
|
external_labels:
|
|
datacenter: dc-123
|