mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-11 14:53:49 +00:00
0fc1130f47
…flags to perform the same as vmalert address https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6735 --------- Signed-off-by: hagen1778 <roman@victoriametrics.com> Co-authored-by: hagen1778 <roman@victoriametrics.com>
105 lines
2.8 KiB
YAML
105 lines
2.8 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:
|
|
- exp_labels:
|
|
cluster: prod
|
|
- eval_time: 1m
|
|
groupname: group2
|
|
alertname: SameAlertNameWithDifferentGroup
|
|
exp_alerts: []
|
|
- eval_time: 150s
|
|
groupname: group1
|
|
alertname: SameAlertNameWithDifferentGroup
|
|
exp_alerts:
|
|
- exp_labels:
|
|
cluster: prod
|
|
- 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", cluster="prod"}'
|
|
- expr: t2
|
|
eval_time: 4m
|
|
exp_samples:
|
|
- value: 4
|
|
labels: '{__name__="t2", cluster="prod"}'
|
|
- 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", cluster="prod"}'
|
|
|
|
alert_rule_test:
|
|
- eval_time: 10m
|
|
groupname: group1
|
|
alertname: InstanceDown
|
|
exp_alerts:
|
|
- exp_labels:
|
|
job: vmagent1
|
|
severity: page
|
|
instance: localhost:9090
|
|
cluster: prod
|
|
exp_annotations:
|
|
summary: "Instance localhost:9090 down"
|
|
description: "localhost:9090 of job vmagent1 in cluster prod has been down for more than 5 minutes."
|
|
dashboard: "http://grafana:3000/d/dashboard?orgId=1"
|
|
|
|
- eval_time: 0
|
|
groupname: group1
|
|
alertname: AlwaysFiring
|
|
exp_alerts:
|
|
- exp_labels:
|
|
cluster: prod
|
|
|
|
- eval_time: 0
|
|
groupname: alerts
|
|
alertname: InstanceDown
|
|
exp_alerts: []
|
|
|