mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-19 15:30:17 +00:00
docs/alert-tools add yaml output type for the correct displaying
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
This commit is contained in:
parent
130e0ea5f0
commit
c8dfead6b1
2 changed files with 22 additions and 18 deletions
|
@ -13,6 +13,7 @@ It will perform the following actions:
|
||||||
* checks whether the firing alerts or resulting recording rules match the expected results.
|
* checks whether the firing alerts or resulting recording rules match the expected results.
|
||||||
|
|
||||||
See how to run vmalert-tool for unit test below:
|
See how to run vmalert-tool for unit test below:
|
||||||
|
|
||||||
```
|
```
|
||||||
# Run vmalert-tool with one or multiple test files via --files cmd-line flag
|
# Run vmalert-tool with one or multiple test files via --files cmd-line flag
|
||||||
./vmalert-tool unittest --files test1.yaml --files test2.yaml
|
./vmalert-tool unittest --files test1.yaml --files test2.yaml
|
||||||
|
@ -26,7 +27,8 @@ which aren't always backward compatible with [PromQL](https://prometheus.io/docs
|
||||||
### Test file format
|
### Test file format
|
||||||
|
|
||||||
The configuration format for files specified in `--files` cmd-line flag is the following:
|
The configuration format for files specified in `--files` cmd-line flag is the following:
|
||||||
```
|
|
||||||
|
```yaml
|
||||||
# Path to the files or http url containing [rule groups](https://docs.victoriametrics.com/vmalert.html#groups) configuration.
|
# Path to the files or http url containing [rule groups](https://docs.victoriametrics.com/vmalert.html#groups) configuration.
|
||||||
# Enterprise version of vmalert-tool supports S3 and GCS paths to rules.
|
# Enterprise version of vmalert-tool supports S3 and GCS paths to rules.
|
||||||
rule_files:
|
rule_files:
|
||||||
|
@ -47,7 +49,7 @@ tests:
|
||||||
|
|
||||||
#### `<test_group>`
|
#### `<test_group>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# Interval between samples for input series
|
# Interval between samples for input series
|
||||||
interval: <duration>
|
interval: <duration>
|
||||||
# Time series to persist into the database according to configured <interval> before running tests.
|
# Time series to persist into the database according to configured <interval> before running tests.
|
||||||
|
@ -73,7 +75,7 @@ external_labels:
|
||||||
|
|
||||||
#### `<series>`
|
#### `<series>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# series in the following format '<metric name>{<label name>=<label value>, ...}'
|
# series in the following format '<metric name>{<label name>=<label value>, ...}'
|
||||||
# Examples:
|
# Examples:
|
||||||
# series_name{label1="value1", label2="value2"}
|
# series_name{label1="value1", label2="value2"}
|
||||||
|
@ -102,7 +104,7 @@ So you will need to specify both `groupname` and `alertname` under a single `<al
|
||||||
but no need to add them under `exp_alerts`.
|
but no need to add them under `exp_alerts`.
|
||||||
You can also pass `--disableAlertgroupLabel` to skip `alertgroup` check.
|
You can also pass `--disableAlertgroupLabel` to skip `alertgroup` check.
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# The time elapsed from time=0s when this alerting rule should be checked.
|
# The time elapsed from time=0s when this alerting rule should be checked.
|
||||||
# Means this rule should be firing at this point, or shouldn't be firing if 'exp_alerts' is empty.
|
# Means this rule should be firing at this point, or shouldn't be firing if 'exp_alerts' is empty.
|
||||||
eval_time: <duration>
|
eval_time: <duration>
|
||||||
|
@ -122,7 +124,7 @@ exp_alerts:
|
||||||
|
|
||||||
#### `<alert>`
|
#### `<alert>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# These are the expanded labels and annotations of the expected alert.
|
# These are the expanded labels and annotations of the expected alert.
|
||||||
# Note: labels also include the labels of the sample associated with the alert
|
# Note: labels also include the labels of the sample associated with the alert
|
||||||
exp_labels:
|
exp_labels:
|
||||||
|
@ -133,7 +135,7 @@ exp_annotations:
|
||||||
|
|
||||||
#### `<metricsql_expr_test>`
|
#### `<metricsql_expr_test>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# Expression to evaluate
|
# Expression to evaluate
|
||||||
expr: <string>
|
expr: <string>
|
||||||
|
|
||||||
|
@ -147,7 +149,7 @@ exp_samples:
|
||||||
|
|
||||||
#### `<sample>`
|
#### `<sample>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# Labels of the sample in usual series notation '<metric name>{<label name>=<label value>, ...}'
|
# Labels of the sample in usual series notation '<metric name>{<label name>=<label value>, ...}'
|
||||||
# Examples:
|
# Examples:
|
||||||
# series_name{label1="value1", label2="value2"}
|
# series_name{label1="value1", label2="value2"}
|
||||||
|
@ -167,7 +169,7 @@ With `rules.yaml` in the same directory, run `./vmalert-tool unittest --files=./
|
||||||
|
|
||||||
#### `test.yaml`
|
#### `test.yaml`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
rule_files:
|
rule_files:
|
||||||
- rules.yaml
|
- rules.yaml
|
||||||
|
|
||||||
|
@ -218,7 +220,7 @@ tests:
|
||||||
|
|
||||||
#### `alerts.yaml`
|
#### `alerts.yaml`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# This is the rules file.
|
# This is the rules file.
|
||||||
|
|
||||||
groups:
|
groups:
|
||||||
|
|
|
@ -22,6 +22,7 @@ It will perform the following actions:
|
||||||
* checks whether the firing alerts or resulting recording rules match the expected results.
|
* checks whether the firing alerts or resulting recording rules match the expected results.
|
||||||
|
|
||||||
See how to run vmalert-tool for unit test below:
|
See how to run vmalert-tool for unit test below:
|
||||||
|
|
||||||
```
|
```
|
||||||
# Run vmalert-tool with one or multiple test files via --files cmd-line flag
|
# Run vmalert-tool with one or multiple test files via --files cmd-line flag
|
||||||
./vmalert-tool unittest --files test1.yaml --files test2.yaml
|
./vmalert-tool unittest --files test1.yaml --files test2.yaml
|
||||||
|
@ -35,7 +36,8 @@ which aren't always backward compatible with [PromQL](https://prometheus.io/docs
|
||||||
### Test file format
|
### Test file format
|
||||||
|
|
||||||
The configuration format for files specified in `--files` cmd-line flag is the following:
|
The configuration format for files specified in `--files` cmd-line flag is the following:
|
||||||
```
|
|
||||||
|
```yaml
|
||||||
# Path to the files or http url containing [rule groups](https://docs.victoriametrics.com/vmalert.html#groups) configuration.
|
# Path to the files or http url containing [rule groups](https://docs.victoriametrics.com/vmalert.html#groups) configuration.
|
||||||
# Enterprise version of vmalert-tool supports S3 and GCS paths to rules.
|
# Enterprise version of vmalert-tool supports S3 and GCS paths to rules.
|
||||||
rule_files:
|
rule_files:
|
||||||
|
@ -56,7 +58,7 @@ tests:
|
||||||
|
|
||||||
#### `<test_group>`
|
#### `<test_group>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# Interval between samples for input series
|
# Interval between samples for input series
|
||||||
interval: <duration>
|
interval: <duration>
|
||||||
# Time series to persist into the database according to configured <interval> before running tests.
|
# Time series to persist into the database according to configured <interval> before running tests.
|
||||||
|
@ -82,7 +84,7 @@ external_labels:
|
||||||
|
|
||||||
#### `<series>`
|
#### `<series>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# series in the following format '<metric name>{<label name>=<label value>, ...}'
|
# series in the following format '<metric name>{<label name>=<label value>, ...}'
|
||||||
# Examples:
|
# Examples:
|
||||||
# series_name{label1="value1", label2="value2"}
|
# series_name{label1="value1", label2="value2"}
|
||||||
|
@ -111,7 +113,7 @@ So you will need to specify both `groupname` and `alertname` under a single `<al
|
||||||
but no need to add them under `exp_alerts`.
|
but no need to add them under `exp_alerts`.
|
||||||
You can also pass `--disableAlertgroupLabel` to skip `alertgroup` check.
|
You can also pass `--disableAlertgroupLabel` to skip `alertgroup` check.
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# The time elapsed from time=0s when this alerting rule should be checked.
|
# The time elapsed from time=0s when this alerting rule should be checked.
|
||||||
# Means this rule should be firing at this point, or shouldn't be firing if 'exp_alerts' is empty.
|
# Means this rule should be firing at this point, or shouldn't be firing if 'exp_alerts' is empty.
|
||||||
eval_time: <duration>
|
eval_time: <duration>
|
||||||
|
@ -131,7 +133,7 @@ exp_alerts:
|
||||||
|
|
||||||
#### `<alert>`
|
#### `<alert>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# These are the expanded labels and annotations of the expected alert.
|
# These are the expanded labels and annotations of the expected alert.
|
||||||
# Note: labels also include the labels of the sample associated with the alert
|
# Note: labels also include the labels of the sample associated with the alert
|
||||||
exp_labels:
|
exp_labels:
|
||||||
|
@ -142,7 +144,7 @@ exp_annotations:
|
||||||
|
|
||||||
#### `<metricsql_expr_test>`
|
#### `<metricsql_expr_test>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# Expression to evaluate
|
# Expression to evaluate
|
||||||
expr: <string>
|
expr: <string>
|
||||||
|
|
||||||
|
@ -156,7 +158,7 @@ exp_samples:
|
||||||
|
|
||||||
#### `<sample>`
|
#### `<sample>`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# Labels of the sample in usual series notation '<metric name>{<label name>=<label value>, ...}'
|
# Labels of the sample in usual series notation '<metric name>{<label name>=<label value>, ...}'
|
||||||
# Examples:
|
# Examples:
|
||||||
# series_name{label1="value1", label2="value2"}
|
# series_name{label1="value1", label2="value2"}
|
||||||
|
@ -176,7 +178,7 @@ With `rules.yaml` in the same directory, run `./vmalert-tool unittest --files=./
|
||||||
|
|
||||||
#### `test.yaml`
|
#### `test.yaml`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
rule_files:
|
rule_files:
|
||||||
- rules.yaml
|
- rules.yaml
|
||||||
|
|
||||||
|
@ -227,7 +229,7 @@ tests:
|
||||||
|
|
||||||
#### `alerts.yaml`
|
#### `alerts.yaml`
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# This is the rules file.
|
# This is the rules file.
|
||||||
|
|
||||||
groups:
|
groups:
|
||||||
|
|
Loading…
Reference in a new issue