From aee3e5131518f701706946314e66fd4e6ad2fbde Mon Sep 17 00:00:00 2001 From: Artem Navoiev Date: Fri, 26 Jan 2024 07:30:45 -0800 Subject: [PATCH] =?UTF-8?q?docs:=20remove=20raw=20and=20endraw=20tags=20as?= =?UTF-8?q?=20they=20are=20not=20needed=20for=20the=20new=20v=E2=80=A6=20(?= =?UTF-8?q?#5696)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: remove raw and endraw tags as they are not needed for the new version of site Signed-off-by: Artem Navoiev * revert formating in vmaler Signed-off-by: Artem Navoiev --------- Signed-off-by: Artem Navoiev --- docs/CHANGELOG_2022.md | 10 +++---- docs/PerTenantStatistic.md | 2 -- docs/enterprise.md | 2 -- ...erting-vmalert-managed-victoria-metrics.md | 6 ----- docs/operator/quick-start.md | 2 -- docs/operator/resources/vmalert.md | 2 -- docs/operator/resources/vmalertmanager.md | 2 -- docs/operator/resources/vmrule.md | 4 --- docs/vmagent.md | 4 +-- docs/vmalert-tool.md | 2 -- docs/vmalert.md | 27 ++++++++----------- 11 files changed, 16 insertions(+), 47 deletions(-) diff --git a/docs/CHANGELOG_2022.md b/docs/CHANGELOG_2022.md index 4a3ffb6e01..fc83ba0d47 100644 --- a/docs/CHANGELOG_2022.md +++ b/docs/CHANGELOG_2022.md @@ -276,7 +276,7 @@ See [these docs](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#m * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): add experimental feature for displaying last 10 states of the rule (recording or alerting) evaluation. The state is available on the Rule page, which can be opened by clicking on `Details` link next to Rule's name on the `/groups` page. * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): allow using extra labels in annotiations. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3013). * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): allow configuring authorization params per list of targets in vmalert's notifier config for `static_configs`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2690). -* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): allow using {% raw %}`{{$labels}}`{% endraw %} for templating in command-line flag `-external.alert.source`. The change supposed to provide additional flexibility for generating alert's source link based on labels values. +* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): allow using `{{$labels}}` for templating in command-line flag `-external.alert.source`. The change supposed to provide additional flexibility for generating alert's source link based on labels values. * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): add `vm_account_id` and `vm_project_id` labels to results of alerting and recording rules if `-clusterMode` is enabled. This improves [multitenant support in vmalert](https://docs.victoriametrics.com/vmalert.html#multitenancy). * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): minimize the time needed for reading large responses from scrape targets in [stream parsing mode](https://docs.victoriametrics.com/vmagent.html#stream-parsing-mode). This should reduce scrape durations for such targets as [kube-state-metrics](https://github.com/kubernetes/kube-state-metrics) running in a big Kubernetes cluster. * FEATURE: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): add [sort_by_label_numeric](https://docs.victoriametrics.com/MetricsQL.html#sort_by_label_numeric) and [sort_by_label_numeric_desc](https://docs.victoriametrics.com/MetricsQL.html#sort_by_label_numeric_desc) functions for [numeric sort](https://www.gnu.org/software/coreutils/manual/html_node/Version-sort-is-not-the-same-as-numeric-sort.html) of input time series by the specified labels. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2938). @@ -331,7 +331,7 @@ Released at 2022-08-31 **Update note 1:** [vmalert](https://docs.victoriametrics.com/vmalert.html) by default hides values of `-remoteWrite.url`, `-remoteRead.url` and `-datasource.url` in logs and at `http://vmalert:8880/flags` for security reasons. See the corresponding SECURITY change in the Chagelog below for additional info. -**Update note 2:** [vmalert](https://docs.victoriametrics.com/vmalert.html) by default points alert source url to `/vmalert/alert?...` aka [web UI](https://docs.victoriametrics.com/vmalert.html#web) instead of `/vmalert/api/v1/alert?...` aka JSON handler. The old behavior can be achieved by setting {% raw %}`-external.alert.source=vmalert/api/v1/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}`{% endraw %} command-line flag. +**Update note 2:** [vmalert](https://docs.victoriametrics.com/vmalert.html) by default points alert source url to `/vmalert/alert?...` aka [web UI](https://docs.victoriametrics.com/vmalert.html#web) instead of `/vmalert/api/v1/alert?...` aka JSON handler. The old behavior can be achieved by setting `-external.alert.source=vmalert/api/v1/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}` command-line flag. * 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). * SECURITY: upgrade base docker image (alpine) from 3.16.1 to 3.16.2. See [alpine 3.16.2 release notes](https://alpinelinux.org/posts/Alpine-3.13.12-3.14.8-3.15.6-3.16.2-released.html). @@ -344,7 +344,7 @@ Released at 2022-08-31 * FEATURE: [monitoring](https://docs.victoriametrics.com/#monitoring): expose `vm_hourly_series_limit_max_series`, `vm_hourly_series_limit_current_series`, `vm_daily_series_limit_max_series` and `vm_daily_series_limit_current_series` metrics when `-search.maxHourlySeries` or `-search.maxDailySeries` limits are set. This allows alerting when the number of unique series reaches the configured limits. See [these docs](https://docs.victoriametrics.com/#cardinality-limiter) for details. * FEATURE: [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html): reduce the amounts of logging at `vmstorage` when `vmselect` connects/disconnects to `vmstorage`. * 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 ability to use {% raw %}`{{label_name}}`{% endraw %} placeholders in the `replacement` option of relabeling rules. This simplifies constructing label values from multiple existing label values. See [these docs](https://docs.victoriametrics.com/vmagent.html#relabeling-enhancements) for details. +* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add ability to use `{{label_name}}` placeholders in the `replacement` option of relabeling rules. This simplifies constructing label values from multiple existing label values. See [these docs](https://docs.victoriametrics.com/vmagent.html#relabeling-enhancements) for details. * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): generate additional per-target metrics - `scrape_series_limit`, `scrape_series_current` and `scrape_series_limit_samples_dropped` if series limit is set according to [these docs](https://docs.victoriametrics.com/vmagent.html#cardinality-limiter). This simplifies alerting on targets with the exceeded series limit. See [these docs](https://docs.victoriametrics.com/vmagent.html#automatically-generated-metrics) for details on these metrics. * 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). * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `__meta_kubernetes_service_port_number` meta-label for `role: service` in [kubernetes_sd_configs](https://docs.victoriametrics.com/sd_configs.html#kubernetes_sd_configs) in the same way as Prometheus 2.38 [does](https://github.com/prometheus/prometheus/pull/11002). @@ -354,7 +354,7 @@ Released at 2022-08-31 * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): add `toTime()` template function in the same way as Prometheus 2.38 [does](https://github.com/prometheus/prometheus/pull/10993). See [these docs](https://prometheus.io/docs/prometheus/latest/configuration/template_reference/#numbers). * 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: [vmalert](https://docs.victoriametrics.com/vmalert.html): add `$activeAt` template variable. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2999). See the full list of supported variables [here](https://docs.victoriametrics.com/vmalert.html#templating). Thanks to @laixintao for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3000). -* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): point alert source to [vmalert's UI](https://docs.victoriametrics.com/vmalert.html#web) at `/vmalert/alert?...` instead of JSON handler at `/vmalert/api/v1/alert?...`. This improves user experience. The old behavior can be achieved by setting {% raw %}`-external.alert.source=vmalert/api/v1/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}`{% endraw %} command-line flag. +* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): point alert source to [vmalert's UI](https://docs.victoriametrics.com/vmalert.html#web) at `/vmalert/alert?...` instead of JSON handler at `/vmalert/api/v1/alert?...`. This improves user experience. The old behavior can be achieved by setting `-external.alert.source=vmalert/api/v1/alert?group_id={{.GroupID}}&alert_id={{.AlertID}}` command-line flag. * BUGFIX: prevent from excess CPU usage when the storage enters [read-only mode](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#readonly-mode). * BUGFIX: improve performance for requests to [/api/v1/labels](https://docs.victoriametrics.com/url-examples.html#apiv1labels) and [/api/v1/label/.../values](https://docs.victoriametrics.com/url-examples.html#apiv1labelvalues) when the filter in the `match[]` query arg matches small number of time series. The performance for this case has been reduced in [v1.78.0](https://docs.victoriametrics.com/CHANGELOG.html#v1780). See [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2978) and [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1533) issues. @@ -652,11 +652,9 @@ scrape_configs: * BUGFIX: consistently name binaries at [releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) in the form `$(APP_NAME)-$(GOOS)-$(GOARCH)-$(VERSION).tar.gz`. For example, `victoria-metrics-linux-amd64-v1.79.0.tar.gz`. Previously the `$(GOOS)` part was missing in binaries for Linux. * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): allow using `__name__` label (aka [metric name](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors)) in alerting annotations. For example: -{% raw %} ```console {{ $labels.__name__ }}: Too high connection number for "{{ $labels.instance }} ``` -{% endraw %} * BUGFIX: limit max memory occupied by the cache, which stores parsed regular expressions. Previously too long regular expressions passed in [MetricsQL queries](https://docs.victoriametrics.com/MetricsQL.html) could result in big amounts of used memory (e.g. multiple of gigabytes). Now the max cache size for parsed regexps is limited to a a few megabytes. * BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly handle partial counter resets when calculating [rate](https://docs.victoriametrics.com/MetricsQL.html#rate), [irate](https://docs.victoriametrics.com/MetricsQL.html#irate) and [increase](https://docs.victoriametrics.com/MetricsQL.html#increase) functions. Previously these functions could return zero values after partial counter resets until the counter increases to the last value before partial counter reset. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2787). diff --git a/docs/PerTenantStatistic.md b/docs/PerTenantStatistic.md index 13307c676b..95e922b8d1 100644 --- a/docs/PerTenantStatistic.md +++ b/docs/PerTenantStatistic.md @@ -67,7 +67,6 @@ to prevent limits exhaustion. Here is an alert example for high churn rate by the tenant: -{% raw %} ```yaml - alert: TooHighChurnRate @@ -87,4 +86,3 @@ Here is an alert example for high churn rate by the tenant: High Churn Rate is tightly connected with database performance and may result in unexpected OOM's or slow queries." ``` -{% endraw %} diff --git a/docs/enterprise.md b/docs/enterprise.md index 8d0ee870a2..0bd2625371 100644 --- a/docs/enterprise.md +++ b/docs/enterprise.md @@ -280,7 +280,6 @@ All the VictoriaMetrics Enterprise components expose the following metrics at th Example alerts for [vmalert](https://docs.victoriametrics.com/vmalert.html) based on these metrics: -{% raw %} ```yaml groups: - name: vm-license @@ -304,4 +303,3 @@ groups: description: "{{ $labels.instance }} of job {{ $labels.job }} license expires in {{ $value | humanizeDuration }}. Please make sure to update the license before it expires." ``` -{% endraw %} diff --git a/docs/managed-victoriametrics/alerting-vmalert-managed-victoria-metrics.md b/docs/managed-victoriametrics/alerting-vmalert-managed-victoria-metrics.md index 9f0db3e58a..a6c15999da 100644 --- a/docs/managed-victoriametrics/alerting-vmalert-managed-victoria-metrics.md +++ b/docs/managed-victoriametrics/alerting-vmalert-managed-victoria-metrics.md @@ -33,7 +33,6 @@ An example file with one alerting rule. alerts.yml -{% raw %} ```yaml groups: - name: common @@ -47,7 +46,6 @@ groups: summary: "{{ $labels.job }} instance: {{$labels.instance }} is not up" description: "Job {{ $labels.job }} instance: {{$labels.instance }} is not up for the last 1 minute" ``` -{% endraw %} ### Managed VictoriaMetrics access token and deployment endpoint @@ -90,7 +88,6 @@ docker run -it -p 8080:8080 -v $(pwd)/alerts.yml:/etc/alerts/alerts.yml victoria ##### Helm Chart -{% raw %} ```console export TOKEN=81e8226e-****-****-****-************ export MANAGED_VM_URL=https://gw-c15-1c.cloud.victoriametrics.com @@ -128,7 +125,6 @@ server: description: "Job {{ $labels.job }} instance: {{$labels.instance }} is not up for the last 1 minute" EOF ``` -{% endraw %} ##### VMalert CRD for vmoperator @@ -207,7 +203,6 @@ docker run -it -p 8080:8080 -v $(pwd)/alerts.yml:/etc/alerts/alerts.yml victoria ##### Helm Chart -{% raw %} ```console export TOKEN=76bc5470-****-****-****-************ export MANAGED_VM_READ_URL=https://gw-c15-1a.cloud.victoriametrics.com/select/0/prometheus/ @@ -246,7 +241,6 @@ server: description: "Job {{ $labels.job }} instance: {{$labels.instance }} is not up for the last 1 minute" EOF ``` -{% endraw %} ##### VMalert CRD for vmoperator diff --git a/docs/operator/quick-start.md b/docs/operator/quick-start.md index 30b77ada47..5472ad2e1e 100644 --- a/docs/operator/quick-start.md +++ b/docs/operator/quick-start.md @@ -586,7 +586,6 @@ code vmrule.yaml with the following content: -{% raw %} ```yaml apiVersion: operator.victoriametrics.com/v1beta1 kind: VMRule @@ -606,7 +605,6 @@ spec: value: "{{ $value }}" description: 'error reloading vmalert config, reload count for 5 min {{ $value }}' ``` -{% endraw %} After that you can deploy `vmrule` resource to the kubernetes cluster: diff --git a/docs/operator/resources/vmalert.md b/docs/operator/resources/vmalert.md index 4b086084b6..a8f5151bc4 100644 --- a/docs/operator/resources/vmalert.md +++ b/docs/operator/resources/vmalert.md @@ -310,7 +310,6 @@ with [extraArgs](./README.md#extra-arguments) and specify `tenant` field for groups in [VMRule](./vmrule.md#enterprise-features): -{% raw %} ```yaml apiVersion: operator.victoriametrics.com/v1beta1 kind: VMAlert @@ -356,7 +355,6 @@ spec: value: "{{ $value }}" description: 'error reloading vmalert config, reload count for 5 min {{ $value }}' ``` -{% endraw %} ## Examples diff --git a/docs/operator/resources/vmalertmanager.md b/docs/operator/resources/vmalertmanager.md index 482145edb6..de2ab57aee 100644 --- a/docs/operator/resources/vmalertmanager.md +++ b/docs/operator/resources/vmalertmanager.md @@ -181,7 +181,6 @@ spec: - `spec.templates` - list of keys in `ConfigMaps`, that contains template files for `alertmanager`, e.g.: - {% raw %} ```yaml apiVersion: operator.victoriametrics.com/v1beta1 kind: VMAlertmanager @@ -206,7 +205,6 @@ spec: {{- end }} my-template-2.tmpl: """ ``` - {% endraw %} These templates will be automatically added to `VMAlertmanager` configuration and will be automatically reloaded on changes in source `ConfigMap`. - `spec.configMaps` - list of `ConfigMap` names (in the same namespace) that will be mounted at `VMAlertmanager` diff --git a/docs/operator/resources/vmrule.md b/docs/operator/resources/vmrule.md index 20bfc4ec76..3fbd672ae2 100644 --- a/docs/operator/resources/vmrule.md +++ b/docs/operator/resources/vmrule.md @@ -44,7 +44,6 @@ you need to **[enable VMAlert Enterprise](./vmalert.md#enterprise-features)**. After that you can add `tenant` field for groups in `VMRule`: -{% raw %} ```yaml apiVersion: operator.victoriametrics.com/v1beta1 kind: VMRule @@ -67,13 +66,11 @@ spec: value: "{{ $value }}" description: 'error reloading vmalert config, reload count for 5 min {{ $value }}' ``` -{% endraw %} ## Examples ### Alerting rule -{% raw %} ```yaml apiVersion: operator.victoriametrics.com/v1beta1 kind: VMRule @@ -93,7 +90,6 @@ spec: value: "{{ $value }}" description: 'error reloading vmalert config, reload count for 5 min {{ $value }}' ``` -{% endraw %} ### Recording rule diff --git a/docs/vmagent.md b/docs/vmagent.md index a0d6f37a39..d8b203b828 100644 --- a/docs/vmagent.md +++ b/docs/vmagent.md @@ -559,16 +559,14 @@ The following articles contain useful information about Prometheus relabeling: `vmagent` provides the following enhancements on top of Prometheus-compatible relabeling: -* The `replacement` option can refer arbitrary labels via {% raw %}`{{label_name}}`{% endraw %} placeholders. +* The `replacement` option can refer arbitrary labels via `{{label_name}}` placeholders. Such placeholders are substituted with the corresponding label value. For example, the following relabeling rule sets `instance-job` label value to `host123-foo` when applied to the metric with `{instance="host123",job="foo"}` labels: - {% raw %} ```yaml - target_label: "instance-job" replacement: "{{instance}}-{{job}}" ``` - {% endraw %} * An optional `if` filter can be used for conditional relabeling. The `if` filter may contain arbitrary [time series selector](https://docs.victoriametrics.com/keyConcepts.html#filtering). diff --git a/docs/vmalert-tool.md b/docs/vmalert-tool.md index ef832cdfc9..a80698f104 100644 --- a/docs/vmalert-tool.md +++ b/docs/vmalert-tool.md @@ -254,7 +254,6 @@ tests: #### `alerts.yaml` -{% raw %} ```yaml # This is the rules file. @@ -279,4 +278,3 @@ groups: - record: suquery_interval_test expr: count_over_time(up[5m:]) ``` -{% endraw %} diff --git a/docs/vmalert.md b/docs/vmalert.md index 1ae57dd6be..8ad72d2c41 100644 --- a/docs/vmalert.md +++ b/docs/vmalert.md @@ -274,15 +274,15 @@ 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. | {% raw %}Number of connections is {{ $value }}{% endraw %} | -| $activeAt or .ActiveAt | The moment of [time](https://pkg.go.dev/time) when alert became active (`pending` or `firing`). | {% raw %}http://vm-grafana.com/?viewPanel=&from={{($activeAt.Add (parseDurationTime \"1h\")).UnixMilli}}&to={{($activeAt.Add (parseDurationTime \"-1h\")).UnixMilli}}{% 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|queryEscape }}{% endraw %} | -| $for or .For | Alert's configured for param. | {% raw %}Number of connections is too high for more than {{ .For }}{% 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 %} | +| $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/?viewPanel=&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.". | 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|queryEscape }} | +| $for or .For | Alert's configured for param. | Number of connections is too high for more than {{ .For }} | +| $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 | Additionally, `vmalert` provides some extra templating functions listed [here](#template-functions) and [reusable templates](#reusable-templates). @@ -309,7 +309,7 @@ Additionally, `vmalert` provides some extra templating functions listed [here](# - `pathEscape` - escapes the input string, so it can be safely put inside path part of URL. - `pathPrefix` - returns the path part of the `-external.url` command-line flag. - `query` - executes the [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html) query against `-datasource.url` and returns the query result. - For example, {% raw %}`{{ query "sort_desc(process_resident_memory_bytes)" | first | value }}`{% endraw %} executes the `sort_desc(process_resident_memory_bytes)` + For example, `{{ query "sort_desc(process_resident_memory_bytes)" | first | value }}` executes the `sort_desc(process_resident_memory_bytes)` query at `-datasource.url` and returns the first result. - `queryEscape` - escapes the input string, so it can be safely put inside [query arg](https://en.wikipedia.org/wiki/Percent-encoding) part of URL. - `quotesEscape` - escapes the input string, so it can be safely embedded into JSON string. @@ -334,7 +334,6 @@ set the path via `-rule.templates` flag. For example, template `grafana.filter` can be defined as following: -{% raw %} ``` {{ define "grafana.filter" -}} {{- $labels := .arg0 -}} @@ -345,11 +344,9 @@ For example, template `grafana.filter` can be defined as following: {{- end -}} {{- end -}} ``` -{% endraw %} And then used in annotations: -{% raw %} ```yaml groups: - name: AlertGroupName @@ -363,7 +360,6 @@ groups: annotations: dashboard: '{{ $externalURL }}/d/dashboard?orgId=1{{ template "grafana.filter" (args .CommonLabels "account_id" "any_label") }}' ``` -{% endraw %} The `-rule.templates` flag supports wildcards so multiple files with templates can be loaded. The content of `-rule.templates` can be also [hot reloaded](#hot-config-reload). @@ -949,7 +945,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 %} + ```console -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 . This flag is available only in Enterprise binaries. See https://docs.victoriametrics.com/enterprise.html @@ -1370,7 +1366,6 @@ The shortlist of configuration flags is the following: -version Show VictoriaMetrics version ``` -{% endraw %} ### Hot config reload