Examples
VictoriaMetrics Single Alert Example
Overview
- Introduction
- Playground
- Use Cases
- Key Concepts
- Support
Workflow Automation
- Overview
- Syntax
- Examples
Alert Evaluation Engine
Providers
- Overview
- Adding a New Provider
- Provider methods
- Supported Providers
Deployment
- Configuration
- Monitoring
- Authentication
- Provision
- Secret Store
- Deploy On
- Local LLM
- Specifications
Development
Keep API
- providers
- actions
- healthcheck
- topology
- alerts
- deduplications
- maintenance
- incidents
- settings
- workflows
- whoami
- pusher
- status
- rules
- preset
- enrichment
- auth
- metrics
- users
- groups
- mappings
- dashboard
- tags
Keep CLI
Examples
VictoriaMetrics Single Alert Example
This example demonstrates a simple CPU usage alert based on a metric:
# This workflow queries VictoriaMetrics metrics and creates alerts based on CPU usage
workflow:
# Unique identifier for this workflow
id: query-victoriametrics
# Display name shown in the UI
name: victoriametrics-alert-example
# Brief description of what this workflow does
description: Monitors CPU usage metrics from VictoriaMetrics and creates alerts when thresholds are exceeded
# Define how the workflow is triggered
triggers:
- type: manual # Can be triggered manually from the UI
# Steps to execute in order
steps:
- name: victoriametrics-step
provider:
# Use VictoriaMetrics provider config defined in providers.vm
config: "{{ providers.vm }}"
type: victoriametrics
with:
# Query average CPU usage rate
query: avg(rate(process_cpu_seconds_total))
queryType: query
# Actions to take based on the query results
actions:
- name: create-alert
provider:
type: keep
with:
# Create alert if CPU usage exceeds threshold
if: "{{ value.1 }} > 0.0040"
alert:
name: "High CPU Usage"
description: "[Single] CPU usage is high on the VM (created from VM metric)"
# Set severity based on CPU usage thresholds
severity: '{{ value.1 }} > 0.9 ? "critical" : {{ value.1 }} > 0.7 ? "warning" : "info"'
# Alert labels for filtering and routing
labels:
environment: production
app: myapp
service: api
team: devops
owner: alice