docs: add multitenat endpoints usage for vmalert multitenancy (#7665)

### Describe Your Changes

Please provide a brief description of the changes you made. Be as
specific as possible to help others understand the purpose and impact of
your modifications.

### Checklist

The following checks are **mandatory**:

- [ ] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).
This commit is contained in:
Hui Wang 2024-11-27 15:01:11 +08:00 committed by GitHub
parent 7374a8813d
commit cdbe69e62b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -474,6 +474,23 @@ There are the following approaches exist for alerting and recording rules across
For example, `-remoteWrite.url=http://vminsert:8480/insert/123/prometheus` would write recording
rules to `AccountID=123`.
* To use the [multitenant endpoint](https://docs.victoriametrics.com/cluster-victoriametrics/#multitenancy-via-labels) of vminsert as
the `-remoteWrite.url` and vmselect as the `-datasource.url`, add `extra_label` with tenant ID as an HTTP URL parameter for each group.
For example, run vmalert using `-datasource.url=http://vmselect:8481/select/multitenant/prometheus -remoteWrite.url=http://vminsert:8480/insert/multitenant/prometheus`,
along with the rule group:
```yaml
groups:
- name: rules_for_tenant_456:789
params:
extra_label: [vm_account_id=456,vm_project_id=789]
rules:
# Rules for accountID=456, projectID=789
```
The multitenant endpoint in vmselect is less efficient than [specifying tenants in URL](https://docs.victoriametrics.com/cluster-victoriametrics/#url-format).
For security considerations, it is recommended restricting access to multitenant endpoints only to trusted sources, since untrusted source may break per-tenant data by writing unwanted samples or get access to data of arbitrary tenants.
* To specify `tenant` parameter per each alerting and recording group if
[enterprise version of vmalert](https://docs.victoriametrics.com/enterprise/) is used
with `-clusterMode` command-line flag. For example: