Compare commits

...

2 Commits

Author SHA1 Message Date
Hui Wang
b11bb03236 Merge branch 'master' into issue-10911 2026-05-20 22:00:05 +08:00
Haley Wang
0d52c2d2a3 docs: mention how to access a label with dot in its name in vmalert templating 2026-05-20 14:27:26 +08:00

View File

@@ -313,7 +313,7 @@ The following variables are available in templating:
|------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| $value or .Value | The current alert's value. Avoid using value in labels, it may cause unexpected issues. | `Number of connections is {{ $value }}` |
| $activeAt or .ActiveAt | The moment of [time](https://pkg.go.dev/time) when alert became active (`pending` or `firing`). | `http://vm-grafana.com/<dashboard-id>?viewPanel=<panel-id>&from={{($activeAt.Add (parseDurationTime \"-1h\")).UnixMilli}}&to={{($activeAt.Add (parseDurationTime \"1h\")).UnixMilli}}` |
| $labels or .Labels | The list of labels of the current alert. Use as `.Labels.<label_name>`. | `Too high number of connections for {{ .Labels.instance }}` |
| $labels or .Labels | The list of labels of the current alert. Use as `.Labels.<label_name>`. When the label name contains `.`, such as `cpu.mode`, use `{{ index .Labels "cpu.mode" }}` to access label value instead. | `Too high number of connections for {{ .Labels.instance }}` |
| $type or .Type | The rule type: "graphite", "prometheus" or "vlogs" | `Link: /explore?left={"datasource":"{{ if eq .Type "vlogs" }}VictoriaLogs{{ else }}VictoriaMetrics{{ end }}","queries":[{"expr":"{{ .Expr }}"}]}` |
| $alertID or .AlertID | The current alert's ID generated by vmalert. | `Link: /vmalert/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}` |
| $groupID or .GroupID | The current alert's group ID generated by vmalert. | `Link: /vmalert/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}` |