Skip to main content

Overview

By referencing variables from alert labels and attributes, you can modify and customize incident severity, title, description, and other information. This is primarily used in two scenarios:

Event API Reporting

When reporting custom alert events via the alert Event API, you can use the title_rule field to customize the alert title.

Alert Pipeline

Reference variables in alert pipelines to modify alert severity, title, description, and other information.

Event API Example

title_rule
{
  "title_rule": "[TPL]${resource} / ${check}"
}
Specifies resource and check labels as the alert title.

Alert Pipeline Example

Reference Variables in Alert Pipeline

Variable Reference Methods

Reference Labels via ${var}

Use [TPL] as prefix and ${} to reference variables. Variable content is extracted from labels; if extraction fails, <no value> is used as a placeholder.
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

Reference via Golang Template Syntax

Use [TPL] as prefix and {{}} to reference variables (can reference both labels and attributes); if extraction fails, <no value> is used as a placeholder.
RuleVariable 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 Attributes

FieldTypeDescription
TitlestringTitle
DescriptionstringDescription
EventSeveritystringSeverity

FAQ

Depending on which variable retrieval method you use, the title may retain the original variable information or use <no value> as a placeholder.
Even if a variable cannot be retrieved, it won’t affect alert generation. You can debug with confidence.