Alerting: Enable recording rules by default (#105603)
This commit is contained in:
@@ -27,15 +27,12 @@ Grafana provides an internal tool in Alerting which allows you to import Mimir a
|
||||
|
||||
## Before you begin
|
||||
|
||||
The `alertingMigrationUI` [feature flag](/docs/grafana/latest/setup-grafana/configure-grafana/feature-toggles/) needs to be enabled to use this feature.
|
||||
To import recording rules, they [must be configured](ref:configure-recording-rules), and the `grafanaManagedRecordingRulesDatasources` [feature flag](/docs/grafana/latest/setup-grafana/configure-grafana/feature-toggles/) must be enabled.
|
||||
|
||||
To use the migration tool, you need the following [RBAC permissions](/docs/grafana/latest/administration/roles-and-permissions/access-control/):
|
||||
|
||||
- Alerting: Rules Writer
|
||||
- Alerting: Set provisioning status
|
||||
- Datasources: Reader
|
||||
- Folders: Creator
|
||||
- Folders: Creator
|
||||
{{< admonition type="note" >}}
|
||||
The Folders permission is optional and only necessary if you want to create new folders for your target namespace. If your account doesn't have permissions to view a namespace, the tool creates a new one. It is a best practice to prepare an import plan before you convert all your alert rules.
|
||||
{{< /admonition >}}
|
||||
|
||||
@@ -22,8 +22,6 @@ You can convert data source-managed alert rules to Grafana-managed alert rules w
|
||||
|
||||
## Before you begin
|
||||
|
||||
To import recording rules, they [must be configured](ref:configure-recording-rules), and the `grafanaManagedRecordingRulesDatasources` [feature flag](/docs/grafana/latest/setup-grafana/configure-grafana/feature-toggles/) must be enabled.
|
||||
|
||||
To import data source-managed alert rules with Grafana Mimirtool, you need to have the Grafana Mimirtool command-line tool installed.
|
||||
|
||||
You need a service account the following [RBAC permissions](/docs/grafana/latest/administration/roles-and-permissions/access-control/):
|
||||
|
||||
+6
-19
@@ -63,31 +63,18 @@ To configure Grafana-managed recording rules, complete the following steps.
|
||||
|
||||
This section only applies to Grafana OSS and Grafana Enterprise.
|
||||
|
||||
Enable the feature by setting `enabled = true` in the `[recording_rules]` section of the Grafana configuration file. Provide the URL of your Prometheus-compatible remote-write endpoint in the `url` field, along with optional credentials or headers.
|
||||
If a rule does not explicitly specify a target data source for writing (for example, if it was created before Grafana 12.1), Grafana will fall back to the `default_datasource_uid` set in the configuration:
|
||||
|
||||
```
|
||||
[recording_rules]
|
||||
enabled = true
|
||||
url = http://my-example-prometheus.local:9090/api/prom/push
|
||||
basic_auth_username = my-user
|
||||
basic_auth_password = my-pass
|
||||
|
||||
[recording_rules.custom_headers]
|
||||
X-My-Header = MyValue
|
||||
```
|
||||
|
||||
### Per-rule data source
|
||||
|
||||
To choose the remote-write Prometheus data source individually for each recording rule, also enable the `grafanaManagedRecordingRulesDatasources` feature flag.
|
||||
|
||||
When this flag is on, Grafana does not use the `url` defined in the configuration file, and the rule editor shows a dropdown to select the target data source. If a rule does not specify a target, for example it was created before the flag was enabled, Grafana writes to the data source identified by `default_datasource_uid` in the Grafana configuration:
|
||||
|
||||
```
|
||||
[recording_rules]
|
||||
|
||||
default_datasource_uid = my-uid
|
||||
```
|
||||
|
||||
If you previously configured recording rules using the `url` and `basic_auth_*` configuration options, these are no longer supported. You must either:
|
||||
|
||||
- Set `default_datasource_uid` in the `[recording_rules]` section of the configuration file to point to the target data source
|
||||
- Or, before upgrading to Grafana 12.1, enable the `grafanaManagedRecordingRulesDatasources` feature flag and update each recording rule individually to include a target data source
|
||||
|
||||
## Add new recording rule
|
||||
|
||||
To create a new Grafana-managed recording rule:
|
||||
|
||||
Reference in New Issue
Block a user