By referencing alert labels and attributes, you can customize incident severity and title information. This feature is mainly used in the following two scenarios:
title_rule
field to customize the alert title.# Example: Specify resource and check labels as alert title
title_rule: "[TPL]${resource} / ${check}"
Use [TPL] as prefix and ${} to reference variables. Variable content will be extracted from labels; if not found, replaced with <no value>.
Examples:
Rule | Label Values | Generated 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 |
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:
Rule | Label Values | Generated 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 |
Field | Type | Definition |
---|---|---|
Title | string | Title |
Description | string | Description |
EventSeverity | string | Event Severity |
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.