This guide explains the different ways in which you can use vmalert in conjunction with VictoriaMetrics Cloud

Preconditions #
- vmalert is installed. You can obtain it by building it from source , downloading it from the GitHub releases page , or using the docker image Docker Hub or Quay for the container ecosystem (such as docker, k8s, etc.).
- Alertmanager is installed.
- You have a Metrics, Logs, or Traces deployment in VictoriaMetrics Cloud .
Setup #
Alerting and recording rules file(s) #
You need to prepare file(s) with alerting or recording rules.
An example file with one alerting rule.
alerts.yml
groups:
- name: common
rules:
- alert: instanceIsDown
for: 1m
expr: up == 0
labels:
severity: critical
annotations:
summary: "{{ $labels.job }} instance: {{$labels.instance }} is not up"
description: "Job {{ $labels.job }} instance: {{$labels.instance }} is not up for the last 1 minute"
VictoriaMetrics Cloud access token and deployment endpoint #
To use vmalert with VictoriaMetrics Cloud, you must create a read/write token, or use an existing one. The token must have write access to ingest recording rules, ALERTS and ALERTS_FOR_STATE metrics, and read access for rules evaluation.
For instructions on how to create tokens, please refer to this section of the documentation .
vmalert configuration #
VictoriaMetrics Cloud has a built-in VMAlert integration that generates ready-to-run vmalert configuration for your deployment and access token, so there’s no manual URL or token wiring to do by hand.
Open it either from the deployment’s Integrations page (there you’ll also pick a deployment and access token), or from an existing access token’s Show examples menu:

It fills in -datasource.url, -datasource.bearerToken, and -notifier.url for you, with Binary, Docker, Helm Chart, and VMAlert CRD (for vmoperator) variants:

To also persist recording-rule results and the ALERTS/ALERTS_FOR_STATE series, so alert state survives restarts, enable persistence. This adds -remoteWrite.url/-remoteRead.url and requires a read-write token on a Metrics deployment: if the deployment you’re alerting on is itself a Metrics deployment and your token has write access, the integration reuses it directly; otherwise it lets you pick a separate Metrics deployment and token to persist to.
Alerting on Logs or Traces deployments #
vmalert can evaluate rules against a VictoriaLogs or VictoriaTraces deployment just as well as a Metrics one. Since remote write/read only accept the Prometheus remote-write protocol, persisted recording-rule results and alert state still need a VictoriaMetrics deployment to be written to - so in this case, enabling persistence always means picking a separate Metrics deployment and token:
