Flashduty Docs
中文EnglishRoadmapAPI官网控制台
中文EnglishRoadmapAPI官网控制台
  1. Advanced Features
  • Getting Started
    • Introduction
    • Quick start
    • FAQ
    • Product Comparison
  • Incidents
    • What is an Incident
    • View Incidents
    • Handle Incidents
    • Escalations and Assignments
    • Custom Fields
    • Custom Actions
    • Alert Noise Reduction
    • Past Incidents
    • Outlier Incidents
  • Configure Flashduty
    • Channels
    • Integrate Alerts
    • Alert Noise Reduction
    • Escalation Rules
    • Label Enrichment
    • Schedules
    • Templates
    • Service Calendars
    • Preferences
    • Alert Routing
    • Silence and Inhibition
    • Filters
    • Notification Bots
    • Alert Pipeline
  • Platform
    • Teams and Members
    • Permissions
    • Single Sign-On
    • Insights
  • Advanced Features
    • Referencing Variables
    • Dynamic Assignment
  • Integrations
    • Alerts integration
      • Standard Alert Integration
      • Email Integration
      • Nightingale/FlashCat Integration
      • Prometheus Integration
      • Grafana Integration
      • Zabbix Integration
      • Uptime Kuma Integration
      • Alibaba Cloud ARMS Integration
      • Alibaba Cloud Monitor CM Event Integration
      • Alibaba Cloud Monitor CM Metrics Integration
      • Alibaba Cloud SLS Integration
      • AWS CloudWatch Integration
      • Azure Monitor Integration
      • Baidu Cloud BCM Integration
      • Huawei Cloud CES Integration
      • Influxdata Integration
      • Open Falcon Integration
      • PagerDuty Integration
      • Tencent BlueKing Integration
      • Tencent Cloud CLS Integration
      • Tencent Cloud Monitor CM Integration
      • Tencent Cloud EventBridge
      • OceanBase Integration
      • Graylog Integration
      • Skywalking Integration
      • Sentry Integration
      • Jiankongbao Integration
      • AWS EventBridge Integration
      • Dynatrace Integration
      • Huawei Cloud LTS Integration
      • GCP Integration
      • Splunk Alert Events Integration
      • AppDynamics Alert Integration
      • SolarWinds Alert Events Integration
      • Volcengine CM Alert Events Integration
      • Volcengine CM Event Center Integration
      • Volcengine TLS Integration
      • OpManager Integration
      • Meraki Integration
      • Keep Integration
      • ElastAlert2 Alert Integration
      • StateCloud Alert Events
      • Guance Alert Events
      • Zilliz Alert Events
      • Huawei Cloud APM Alerts
      • zstack integration
    • Change integration
      • Standard Change Event
      • Jira Issue Events
    • IM integration
      • Feishu (Lark) Integration Guide
      • Dingtalk Integration
      • WeCom Integration
      • Slack Integration
      • Microsoft Teams Integration
    • Single Sign-On
      • Authing Integration
      • Keycloak Guide
      • OpenLDAP Guide
    • Webhooks
      • Alert webhook
      • Incident webhook
      • Costom action
  • Terms
    • Terms of Service
    • User Agreement/Privary Policy
    • SLA
    • Data Security
  1. Advanced Features

Referencing Variables

Overview


By referencing alert labels and attributes, you can customize incident severity and title information. This feature is mainly used in the following two scenarios:

  1. When reporting custom alert events using the Alert Event API, you can use the title_rule field to customize the alert title.
# Example: Specify resource and check labels as alert title
title_rule: "[TPL]${resource} / ${check}"
  1. In the alert pipeline, you can reference variables to modify incident severity, title, and description.

More Ways to Reference Variables


Generate Using ${var} Label References

Use [TPL] as prefix and ${} to reference variables. Variable content will be extracted from labels; if not found, replaced with <no value>.

Examples:

RuleLabel ValuesGenerated Content
[TPL]${resource} / ${check}{"resource": "127.0.0.1", "check": "cpu idle low"}127.0.0.1 / cpu idle low
[TPL]${resource} / ${check}{"resource": "127.0.0.1"}127.0.0.1 / <no value>
[TPL]${resource} / Host Down{"resource": "127.0.0.1"}127.0.0.1 / Host Down

Generate Using Golang Template Syntax

Use [TPL] as prefix and {{}} to reference variables (can reference labels and other variables). If not found, replaced with <no value>. Variable scope refers to Alert Event Definition.

Examples:

RuleLabel ValuesGenerated Content
[TPL]{{.Labels.resource}} / {{.Labels.check}}{"resource": "127.0.0.1", "check": "cpu idle low"}127.0.0.1 / cpu idle low
[TPL]{{.Labels.resource}} / {{.Labels.check}}{"resource": "127.0.0.1"}127.0.0.1 / <no value>
[TPL]{{.EventSeverity}} / Host Down{"EventSeverity": "Warning"}Warning / Host Down

Supported Attribute List

FieldTypeDefinition
TitlestringTitle
DescriptionstringDescription
EventSeveritystringEvent Severity

FAQ


What happens if a label doesn't exist when using labels to generate titles?

It depends on which variable retrieval method you use. The title might retain the original variable information or use <no value> as a replacement.

Even if variables cannot be retrieved, it won't affect alert generation. You can debug with confidence.

修改于 2025-01-06 03:29:38
上一页
Insights
下一页
Dynamic Assignment
Built with