I’d like to extract my configured alert-rules from a self-hosted Grafana instance and port them over to another instance for initial provisioning. Based on these I’d like to continue working on the alerts, so it should be possible to edit the rules via UI on the new instance.
-
What Grafana version and what operating system are you using?
- Grafana self-hosted v10.4.2
-
What are you trying to achieve?
- Export data of existing rule-groups into portable format via API or UI
- Export data of existing alert-rules into portable format via API or UI
- Add or update an rule-group via API
- Add or update an alert-rule via API
-
How are you trying to achieve it?
- Either export the data using the “Export”-functionality in the Grafana UI or using the REST API and store the result in a JSON file.
- On a new Grafana instance read from the JSON file and add/update the data via REST API
- Using the API via curl (for testing purposes) and later via Ansible (for deployment automation)
-
What happened?
- Export via UI seems to result in different data than the REST API. This however is expected and warned for in the docs.
- Export via API does not contain all the data needed, especially in regards to rule-groups. What do I miss here?
- API is deprecated without any non-deprecated API replacing it. Or do I overlook something?
- API does not return a portable format, as the
folderUiddiffers between Grafana instances. I’d like to transfer an alert-rule from one Grafana instance to another though (staging to production, dev branch to master branch, …). Both instances have the same folder names, but the ids differ. How do I solve that in a good way? - When adding/updating via API I very often simply get “400 - bad request data”, but there is not way to figure out what was wrong (missing attributes, malformed data, …). It’s very hard to figure out what exactly is wrong without a lot of experimentation. Is there a way to get more details about failing requests? Perhaps from the Grafana server logs?
-
What did you expect to happen?
- A way to simple use the Grafana API to transfer alerts between grafana instances
- Docs giving answers to the above questions to allow me to work with the API in an efficient way
-
Can you copy/paste the configuration(s) that you are having problems with?
- Let me know if there’s anything I can paste here to help answering the questions.
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
- A s stated above, nothing helpful.
-
Did you follow any online instructions? If so, what is the URL?
- Provision via File: Not suitable to my usecase because user needs to be able to modify alert rules after initial provisioning
- Grafana API docs: Not really helpful, as there’s not enough detail to answer my above questions
- Grafana Swagger docs: Not really helping as well, even less detail than the API docs
- Found a few forum posts, but nothing really helpful on that matter.
- Found a few blog posts from thirdparties, but nothing useful as well




