diff --git a/app/vmalert/README.md b/app/vmalert/README.md index af514c28f9..24ea7fed42 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -199,15 +199,15 @@ It is allowed to use [Go templating](https://golang.org/pkg/text/template/) in a or execute expressions. The following variables are available in templating: -| Variable | Description | Example | -|------------------------------------|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------| -| $value or .Value | The current alert's value. Avoid using value in labels, it may cause unexpected issues. | "Number of connections is {{ $value }} | -| $labels or .Labels | The list of labels of the current alert. Use as ".Labels.". | "Too high number of connections for {{ .Labels.instance }}" | -| $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}}" | -| $expr or .Expr | Alert's expression. Can be used for generating links to Grafana or other systems. | "/api/v1/query?query={{ $expr|quotesEscape|queryEscape }}" | -| $externalLabels or .ExternalLabels | List of labels configured via `-external.label` command-line flag. | "Issues with {{ $labels.instance }} (datacenter-{{ $externalLabels.dc }})" | -| $externalURL or .ExternalURL | URL configured via `-external.url` command-line flag. Used for cases when vmalert is hidden behind proxy. | "Visit {{ $externalURL }} for more details" | +| Variable | Description | Example | +|------------------------------------|-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| +| $value or .Value | The current alert's value. Avoid using value in labels, it may cause unexpected issues. | {% raw %}"Number of connections is {{ $value }}{% endraw %} | +| $labels or .Labels | The list of labels of the current alert. Use as ".Labels.". | {% raw %}"Too high number of connections for {{ .Labels.instance }}"{% endraw %} | +| $alertID or .AlertID | The current alert's ID generated by vmalert. | {% raw %}"Link: vmalert/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}"{% endraw %} | +| $groupID or .GroupID | The current alert's group ID generated by vmalert. | {% raw %}"Link: vmalert/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}"{% endraw %} | +| $expr or .Expr | Alert's expression. Can be used for generating links to Grafana or other systems. | {% raw %}"/api/v1/query?query={{ $expr|quotesEscape|queryEscape }}"{% endraw %} | +| $externalLabels or .ExternalLabels | List of labels configured via `-external.label` command-line flag. | {% raw %}"Issues with {{ $labels.instance }} (datacenter-{{ $externalLabels.dc }})"{% endraw %} | +| $externalURL or .ExternalURL | URL configured via `-external.url` command-line flag. Used for cases when vmalert is hidden behind proxy. | {% raw %}"Visit {{ $externalURL }} for more details"{% endraw %} | Additionally, `vmalert` provides some extra templating functions listed [here](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmalert/notifier/template_func.go) @@ -636,7 +636,7 @@ Pass `-help` to `vmalert` in order to see the full list of supported command-line flags with their descriptions. The shortlist of configuration flags is the following: - +{% raw %} ``` -clusterMode If clusterMode is enabled, then vmalert automatically adds the tenant specified in config groups to -datasource.url, -remoteWrite.url and -remoteRead.url. See https://docs.victoriametrics.com/vmalert.html#multitenancy @@ -972,6 +972,7 @@ The shortlist of configuration flags is the following: -version Show VictoriaMetrics version ``` +{% endraw %} ### Hot config reload diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0eec544550..d4304e5acc 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -19,6 +19,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * SECURITY: [vmalert](https://docs.victoriametrics.com/vmalert.html): do not expose `-remoteWrite.url`, `-remoteRead.url` and `-datasource.url` command-line flag values in logs and at `http://vmalert:8880/flags` page by default, since they may contain sensitive data such as auth keys. This aligns `vmalert` behaviour with [vmagent](https://docs.victoriametrics.com/vmagent.html), which doesn't expose `-remoteWrite.url` command-line flag value in logs and at `http://vmagent:8429/flags` page by default. Specify `-remoteWrite.showURL`, `-remoteRead.showURL` and `-datasource.showURL` command-line flags for showing values for the corresponding `-*.url` flags in logs. Thanks to @mble for [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2965). +* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): add `$alertID` and `$groupID` template variables. These variables may be used for templating annotations or `-external.alert.source` command-line flag. See the full list of supported variables [here](https://docs.victoriametrics.com/vmalert.html#templating). * FEATURE: return shorter error messages to Grafana and to other clients requesting [/api/v1/query](https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries) and [/api/v1/query_range](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) endpoints. This should simplify reading these errors by humans. The long error message with full context is still written to logs. * FEATURE: [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html): improve performance for heavy queries on systems with many CPU cores. * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add support for MX record types in [dns_sd_configs](https://docs.victoriametrics.com/sd_configs.html#dns_sd_configs) in the same way as Prometheus 2.38 [does](https://github.com/prometheus/prometheus/pull/10099). diff --git a/docs/vmalert.md b/docs/vmalert.md index 7de7504ac7..d2aaf82692 100644 --- a/docs/vmalert.md +++ b/docs/vmalert.md @@ -203,15 +203,15 @@ It is allowed to use [Go templating](https://golang.org/pkg/text/template/) in a or execute expressions. The following variables are available in templating: -| Variable | Description | Example | -|------------------------------------|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------| -| $value or .Value | The current alert's value. Avoid using value in labels, it may cause unexpected issues. | "Number of connections is {{ $value }} | -| $labels or .Labels | The list of labels of the current alert. Use as ".Labels.". | "Too high number of connections for {{ .Labels.instance }}" | -| $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}}" | -| $expr or .Expr | Alert's expression. Can be used for generating links to Grafana or other systems. | "/api/v1/query?query={{ $expr|quotesEscape|queryEscape }}" | -| $externalLabels or .ExternalLabels | List of labels configured via `-external.label` command-line flag. | "Issues with {{ $labels.instance }} (datacenter-{{ $externalLabels.dc }})" | -| $externalURL or .ExternalURL | URL configured via `-external.url` command-line flag. Used for cases when vmalert is hidden behind proxy. | "Visit {{ $externalURL }} for more details" | +| Variable | Description | Example | +|------------------------------------|-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| +| $value or .Value | The current alert's value. Avoid using value in labels, it may cause unexpected issues. | {% raw %}"Number of connections is {{ $value }}{% endraw %} | +| $labels or .Labels | The list of labels of the current alert. Use as ".Labels.". | {% raw %}"Too high number of connections for {{ .Labels.instance }}"{% endraw %} | +| $alertID or .AlertID | The current alert's ID generated by vmalert. | {% raw %}"Link: vmalert/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}"{% endraw %} | +| $groupID or .GroupID | The current alert's group ID generated by vmalert. | {% raw %}"Link: vmalert/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}"{% endraw %} | +| $expr or .Expr | Alert's expression. Can be used for generating links to Grafana or other systems. | {% raw %}"/api/v1/query?query={{ $expr|quotesEscape|queryEscape }}"{% endraw %} | +| $externalLabels or .ExternalLabels | List of labels configured via `-external.label` command-line flag. | {% raw %}"Issues with {{ $labels.instance }} (datacenter-{{ $externalLabels.dc }})"{% endraw %} | +| $externalURL or .ExternalURL | URL configured via `-external.url` command-line flag. Used for cases when vmalert is hidden behind proxy. | {% raw %}"Visit {{ $externalURL }} for more details"{% endraw %} | Additionally, `vmalert` provides some extra templating functions listed [here](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmalert/notifier/template_func.go) @@ -640,7 +640,7 @@ Pass `-help` to `vmalert` in order to see the full list of supported command-line flags with their descriptions. The shortlist of configuration flags is the following: - +{% raw %} ``` -clusterMode If clusterMode is enabled, then vmalert automatically adds the tenant specified in config groups to -datasource.url, -remoteWrite.url and -remoteRead.url. See https://docs.victoriametrics.com/vmalert.html#multitenancy @@ -976,6 +976,7 @@ The shortlist of configuration flags is the following: -version Show VictoriaMetrics version ``` +{% endraw %} ### Hot config reload