Reputation: 121
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"
.
Upvotes: 0
Views: 2383
Reputation: 2663
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/ .
Upvotes: 0
Reputation: 472
Set "readOnly": true in your datasource json object and do a POST call to Grafana API.
Upvotes: 1
Reputation: 28696
Don't use API, but use datasource provisioning with editable: false
.
Upvotes: 3