Export alerting resources

Export your alerting resources, such as alert rules, contact points, and notification policies for provisioning, automatically importing single folders and single groups.

There are distinct methods to export your alerting resources:

NOTE: Alerting resources imported through file provisioning cannot be edited in the Grafana UI. This prevents changes made in the UI from being overridden by file provisioning during Grafana restarts. If you need to modify provisioned alerting resources in Grafana, refer to edit HTTP API alerting resources in the Grafana UI or to edit Terraform alerting resources in the Grafana UI.

Export from the Grafana UI

The export options listed below enable you to download resources in YAML, JSON, or Terraform format, facilitating their provisioning through configuration files or Terraform.

Export alert rules

To export alert rules from the Grafana UI, complete the following steps.

  1. Click Alerts & IRMAlert rules.

  2. To export all Grafana-managed rules, click Export rules.

  3. To export a folder, change the View as to List.

  4. Select the folder you want to export and click the Export rules folder icon.

  5. To export a group, change the View as to Grouped.

  6. Find the group you want to export and click the Export rule group icon.

  7. Choose the format to export in.

    The exported alert rule data appears in different formats - YAML, JSON, Terraform.

  8. Click Copy Code or Download.

Modify alert rule and export rule group without saving changes

NOTE: This feature is for Grafana-managed alert rules only. It is available to Admin, Viewer, and Editor roles.

Use the Modify export mode to edit and export an alert rule without updating it. The exported data includes all alert rules within the same alert group.

To export a modified alert rule without saving the modifications, complete the following steps from the Grafana UI.

  1. Click Alerts & IRMAlert rules.

  2. Locate the alert rule you want to edit and click MoreModify Export to open the Alert Rule form.

  3. From the Alert Rule form, edit the fields you want to change. Changes made are not applied to the alert rule.

  4. Click Export.

  5. Choose the format to export in.

    The exported alert rule group appears in different formats - YAML, JSON, Terraform.

  6. Click Copy Code or Download.

Export contact points

To export contact points from the Grafana UI, complete the following steps.

  1. Click Alerts & IRMContact points.

  2. Find the contact point you want to export and click MoreExport.

  3. Choose the format to export in.

    The exported contact point appears in different formats - YAML, JSON, Terraform.

  4. Click Copy Code or Download.

Export templates

Grafana currently doesn’t offer an Export UI or Export endpoint for notification templates, unlike other Alerting resources presented in this documentation.

However, you can export it by manually copying the content template and title directly from the Grafana UI.

  1. Click Alerts & IRMContact pointsNotification templates tab.

  2. Find the template you want to export.

  3. Copy the content and title.

  4. Adjust it for the file provisioning format or Terraform resource.

Export the notification policy tree

All notification policies are provisioned through a single resource: the root of the notification policy tree.

WARNING: Since the policy tree is a single resource, provisioning it will overwrite a policy tree created through any other means.

To export the notification policy tree from the Grafana UI, complete the following steps.

  1. Click Alerts & IRMNotification policies.

  2. In the Default notification policy section, click Export.

  3. Choose the format to export in.

    The exported contact point appears in different formats - YAML, JSON, Terraform.

  4. Click Copy Code or Download.

Export mute timings

To export mute timings from the Grafana UI, complete the following steps.

  1. Click Alerts & IRMNotification policies, and then the Mute timings tab.

  2. Find the mute timing you want to export and click Export.

  3. Choose the format to export in.

    The exported contact point appears in different formats - YAML, JSON, Terraform.

  4. Click Copy Code or Download.

HTTP Alerting API

You can use the Alerting HTTP API to return existing alerting resources in JSON and import them to another Grafana instance using the same endpoint.

Resource URI

Alert rules

/api/v1/provisioning/alert-rules

Contact points

/api/v1/provisioning/contact-points

Notification policy tree

/api/v1/provisioning/policies

Mute timings

/api/v1/provisioning/mute-timings

Templates

/api/v1/provisioning/templates

However, note the standard endpoints return a JSON format that is not compatible for provisioning through configuration files or Terraform, except the /export endpoints listed below.

Export API endpoints

The Alerting HTTP API provides specific endpoints for exporting alerting resources in YAML or JSON formats, facilitating [provisioning via configuration files][alerting_file_provisioning]. Currently, Terraform format is not supported.

Resource Method / URI Summary

Alert rules

GET /api/v1/provisioning/alert-rules/export

https://grafana.com/docs/grafana/v10.4/alerting/set-up/provision-alerting-resources/http-api-provisioning/#span-idroute-get-alert-rules-exportspan-export-all-alert-rules-in-provisioning-file-format-routegetalertrulesexport[Export all alert rules in provisioning file format.]

Alert rules

GET /api/v1/provisioning/folder/:folderUid/rule-groups/:group/export

https://grafana.com/docs/grafana/v10.4/alerting/set-up/provision-alerting-resources/http-api-provisioning/#span-idroute-get-alert-rule-group-exportspan-export-an-alert-rule-group-in-provisioning-file-format-routegetalertrulegroupexport[Export an alert rule group in provisioning file format.]

Alert rules

GET /api/v1/provisioning/alert-rules/:uid/export

https://grafana.com/docs/grafana/v10.4/alerting/set-up/provision-alerting-resources/http-api-provisioning/#span-idroute-get-alert-rule-exportspan-export-an-alert-rule-in-provisioning-file-format-routegetalertruleexport[Export an alert rule in provisioning file format.]

Contact points

GET /api/v1/provisioning/contact-points/export

https://grafana.com/docs/grafana/v10.4/alerting/set-up/provision-alerting-resources/http-api-provisioning/#span-idroute-get-contactpoints-exportspan-export-all-contact-points-in-provisioning-file-format-routegetcontactpointsexport[Export all contact points in provisioning file format.]

Notification policy tree

GET /api/v1/provisioning/policies/export

https://grafana.com/docs/grafana/v10.4/alerting/set-up/provision-alerting-resources/http-api-provisioning/#span-idroute-get-policy-tree-exportspan-export-the-notification-policy-tree-in-provisioning-file-format-routegetpolicytreeexport[Export the notification policy tree in provisioning file format.]

Mute timings

GET /api/v1/provisioning/mute-timings/export

Export all mute timings in provisioning file format.

Mute timings

GET /api/v1/provisioning/mute-timings/:name/export

https://grafana.com/docs/grafana/v10.4/alerting/set-up/provision-alerting-resources/http-api-provisioning/#span-idroute-get-mute-timing-exportspan-export-a-mute-timing-in-provisioning-file-format-routegetmutetimingexport[Export a mute timing in provisioning file format.]

These endpoints accept a download parameter to download a file containing the exported resources.