I’m trying to create Prometheus data sources in Grafana 8.0.6 via the HTTP API, and then modify them as necessary - all via the API.
I cannot seem to change the readOnly attribute. It appears to stay False no matter what.
This is the template I’m injecting in the API:
ds_template = {
"prom_app": {
"name": "Prometheus app",
"type": "prometheus",
"url": 'http://' + prom_app_host + ':9090',
"access": "proxy",
"readOnly": False,
"isDefault": True,
"basicAuth": False
},
"prom_cluster": {
"name": "Prometheus cluster data READ ONLY",
"type": "prometheus",
"url": 'http://' + prom_cluster_host + ':9090',
"access": "proxy",
"readOnly": True,
"isDefault": False,
"basicAuth": False
}
}
key_head = 'Bearer ' + key
all_head = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': key_head
}
for ds in ds_template:
# use put instead of post for update
r = requests.post(gendp + '/datasources', headers = head, data = ds_template[ds])
No matter what, readOnly stays false.
Is there anything I’m missing?