I am creating a Grafana datasource by a curl call with POST data to the Grafana REST API. This works fine. But is there a way to make this datasource "read-only"? By that I mean that I don't want any Grafana user to be able to delete this datasource from the Grafana web GUI. I am looking for a POST parameter like "editable":"false"
.

- 16,349
- 11
- 65
- 88

- 121
- 1
- 1
- 10
-
[Datasource permissions](http://docs.grafana.org/http_api/datasource_permissions/) are only available in the Enterprise version. – Mike Doe Feb 26 '19 at 10:18
3 Answers
Don't use API, but use datasource provisioning with editable: false
.

- 25,598
- 3
- 38
- 59
-
Thanks for your input. I am running Grafana on docker on AWS EC2. To make a clean cloudformation setup and to make it easy to upgrade I want to use an official docker image of Grafana. This is the reason I want to create the datasource through API instead of provisioning since with provisioning I probably need to build an own image. – user1140596 Feb 27 '19 at 17:18
-
You don't need to create own Docker image. Just use docker volumes and "mount" files from host OS filesystem. – Jan Garaj Feb 27 '19 at 21:32
Set "readOnly": true in your datasource json object and do a POST call to Grafana API.

- 452
- 2
- 10
If you are Grafana admin and have access to the server you can provision datasources from YAML files placed in the provisioning/datasrouces
directory. Datasources provisioned this way are immutable - even Grafana admin user is not able to edit or delete them via UI or API. The only way to edit such datasources is to modify the YAML files in the provisioning folder followed by Grafana restart or datasource reload call to API.
To remove such datasources you need to delete YAML files from provisioning folders on all Grafana servers and remove them from the database.
See https://grafana.com/docs/grafana/latest/administration/provisioning/ .

- 2,423
- 23
- 34