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:
- Grafana UI exports in Terraform format and YAML or JSON formats for file provisioning.
- HTTP Alerting API exports in JSON API format used by the HTTP Alerting API.
- HTTP Alerting API - Export endpoints exports in YAML or JSON formats for file provisioning.
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.
Click Alerts & IRM -> Alert rules.
To export all Grafana-managed rules, click Export rules.
To export a folder, change the View as to List.
Select the folder you want to export and click the Export rules folder icon.
To export a group, change the View as to Grouped.
Find the group you want to export and click the Export rule group icon.
Choose the format to export in.
The exported alert rule data appears in different formats - YAML, JSON, Terraform.
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.
Click Alerts & IRM -> Alert rules.
Locate the alert rule you want to edit and click More -> Modify Export to open the Alert Rule form.
From the Alert Rule form, edit the fields you want to change. Changes made are not applied to the alert rule.
Click Export.
Choose the format to export in.
The exported alert rule group appears in different formats - YAML, JSON, Terraform.
Click Copy Code or Download.
Export contact points
To export contact points from the Grafana UI, complete the following steps.
Click Alerts & IRM -> Contact points.
Find the contact point you want to export and click More -> Export.
Choose the format to export in.
The exported contact point appears in different formats - YAML, JSON, Terraform.
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.
- Click Alerts & IRM -> Contact points -> Notification templates tab.
- Find the template you want to export.
- Copy the content and title.
- 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.
Click Alerts & IRM -> Notification policies.
In the Default notification policy section, click … -> Export.
Choose the format to export in.
The exported contact point appears in different formats - YAML, JSON, Terraform.
Click Copy Code or Download.
Export mute timings
To export mute timings from the Grafana UI, complete the following steps.
Click Alerts & IRM -> Notification policies, and then the Mute timings tab.
Find the mute timing you want to export and click Export.
Choose the format to export in.
The exported contact point appears in different formats - YAML, JSON, Terraform.
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, facilitating provisioning via configuration files, or Terraform (HCL).
Resource | Method / URI | Summary |
---|---|---|
Alert rules | GET /api/v1/provisioning/alert-rules/export | Export all alert rules in provisioning file format. |
Alert rules | GET /api/v1/provisioning/folder/:folderUid/rule-groups/:group/export | Export an alert rule group in provisioning file format. |
Alert rules | GET /api/v1/provisioning/alert-rules/:uid/export | Export an alert rule in provisioning file format. |
Contact points | GET /api/v1/provisioning/contact-points/export | Export all contact points in provisioning file format. |
Notification policy tree | GET /api/v1/provisioning/policies/export | 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 | Export a mute timing in provisioning file format. |
These endpoints accept a download
parameter to download a file containing the exported resources.
Was this page helpful?
Related resources from Grafana Labs
![Getting started with the Grafana LGTM Stack](/static/assets/featured/getting-started-with-grafana-lgtm-stack-amer_featured.png?w=200 200w, /static/assets/featured/getting-started-with-grafana-lgtm-stack-amer_featured.png?w=400 400w)
![Intro to Kubernetes monitoring in Grafana Cloud](/media/webinar/Screenshot-2024-02-12-at-4.09.30-PM.png?w=200 200w, /media/webinar/Screenshot-2024-02-12-at-4.09.30-PM.png?w=400 400w)
![Building advanced Grafana dashboards](/media/webinar/AMER_buildadv_notxt.png?w=200 200w, /media/webinar/AMER_buildadv_notxt.png?w=400 400w)