Versionv1.107.0
Revision6
Size12.6 MB
LicenseApache-2.0
Confinementstrict
Basecore18

VMAlert command-line tool

Screenshot

vmalert-tool

https://docs.victoriametrics.com/vmalert-tool/

Unit testing for rules

https://docs.victoriametrics.com/vmalert-tool/#unit-testing-for-rules

You can use vmalert-tool to run unit tests for alerting and recording rules. It will perform the following actions:
  • sets up an isolated VictoriaMetrics instance;
  • simulates the periodic ingestion of time series;
  • queries the ingested data for recording and alerting rules evaluation like https://docs.victoriametrics.com/vmalert/;
  • checks whether the firing alerts or resulting recording rules match the expected results.

See how to run vmalert-tool for unit test below:

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 is compatible with Prometheus config format for tests (https://prometheus.io/docs/prometheus/latest/configuration/unittestingrules/#test-file-format except) promqlexprtest field. Use metricsqlexprtest field name instead. The name is different because vmalert-tool validates and executes MetricsQL (https://docs.victoriametrics.com/metricsql/) expressions, which aren’t always backward compatible with PromQL (https://prometheus.io/docs/prometheus/latest/querying/basics/).

Update History

v1.107.0 (6)
13 Dec 2025, 09:47 UTC

Published25 Apr 2024, 19:40 UTC

Last updated9 Dec 2024, 16:02 UTC

First seen13 Dec 2025, 09:47 UTC