This is documentation for the next version of Grafana. For the latest stable release, go to the latest version.
Import data source-managed alert rules
Grafana provides an internal tool in Alerting which allows you to import Prometheus and Loki alert rules into Grafana-managed alert rules.
Before you begin
The alertingMigrationUI
and grafanaManagedRecordingRulesDatasources
feature flags needs to be enabled to use this feature.
To use the migration tool, you need the following RBAC permissions:
- Alerting: Rules Writer
- Alerting: Set provisioning status
- Datasources: Reader
- Folders: Creator
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.
How it works
When you use the import tool, a folder of data source-managed rules is copied to another folder as Grafana-managed alert rules, preserving the behavior of the rules, and the original alert rules are kept in their original location.
When data source-managed alert rules are converted to Grafana-managed alert rules, the following are applied to the Grafana-managed alert rules:
- All rules are given
rule_query_offset
offset value of 1m. - The
missing_series_evals_to_resolve
is set to 1 for the new rules. - The newly created rules are given unique UIDs.
Note
Plugin rules that have the label
__grafana_origin
are not included on alert rule imports.
Import alert rules
To convert data source-managed alert rules to Grafana managed alerts:
Go to Alerting > Alert rules.
Navigate to the Data source-managed alert rules section and click Import to Grafana-managed rules.
The import alert rules page opens.
In the Data source dropdown, select the Loki or Prometheus data source of the alert rules.
In Additional settings, select a target folder or designate a new folder to import the rules into.
If you import the rules into an existing folder, don’t chose a folder with existing alert rules, as they could get overwritten.
(Optional) Select a Namespace and/or Group to determine which rules are imported.
(Optional) Turn on Pause imported alerting rules.
Pausing stops alert rule evaluation and doesn’t create any alert instances for the newly created Grafana-managed alert rules.
(Optional) Turn on Pause imported recording rules.
Pausing stops alert rule evaluation behavior for the newly created Grafana-managed alert rules.
Select which target data source the new recording rule is written to.
Click Import.
A preview shows the rules that will be imported. If your target folder contains folders with the same name of the imported folders, a warning displays to inform you. You can explore the warning to see a list of folders that might be overwritten.
Click Yes, import to import the rules.