Changed files: dashboards/Merlin7/Merlin7_Slurm_Native_OpenMetrics.json
Grafana Resources Backup
Collection of scripts and main storage for all the JSON resources from our Grafana instance.
Scripts are run on a schedule and any updates to the Grafana resourcesa are saved locally and commited automatically.
Run Manully
Call the ./grafana-save.sh script, this will call all other scripts
and update/add the Grafana resource JSON files. Remember you need to
set the API_TOKEN=... environment variable beforehand!
You can of course call the individual scripts directly.
API Token
Since Grafana V11/V12 there is only way to get a API token and that is to create a "Service Account". Within the service account there is an option to generate token(s), this helps to better bind tokens to accounts which themselves have specific roles (and in the backend RBAC defined permissions and scopes).
Notes
The generated JSON files cannot be imported via the UI (or the internal "provisioning" API),
they should be imported using the POST create API endpoints. They might
need to be "massaged" so that the API accepts them, like for instance null'ing
the uid and name fields.
The "provisioning" API is specifically designed to read in local resources files (often in YAML) as part of Grafana's installation or reconfiguration on restart. The resources are thus imported automatically but cannot be modified through the UI anymore, only by modifying the resource files and restarting Grafana can they be changed.
The Grafana HTTP API is going through several changes, designed to modularise and
make the overall structure of the HTTP API more consistent. Some of these modules,
like dashboard.grafana.app (which will replace the /api/search and similar
endpoints) have different implementations which are namespaced by version:
/apis/dashboard.grafana.app/v2/.... All of these details can be directly
read out of the API, e.g. reading /apis/ will list all modules and versions.
ToDo
- migrate the dashboard save script to the new API
-
not possible at the moment due to issues with permissions?!
$ curl -L -H "Authorization: Bearer $GRAF_TOKEN" https://grafana-test.psi.ch/apis/dashboard.grafana.app/v1/namespaces/defaults/dashboards { "kind": "Status", "apiVersion": "v1", "metadata": {}, "status": "Failure", "message": "dashboards.dashboard.grafana.app is forbidden: User \"svc-test-api\" cannot list resource \"dashboards\" in API group \"dashboard.grafana.app\" in the namespace \"defaults\": invalid org", "reason": "Forbidden", "details": { "group": "dashboard.grafana.app", "kind": "dashboards" }, "code": 403 }
-