Skip to content

Monitoring & logging: Grafana

Grafana commands from the Monitoring & logging folder.

Index
3 items

Grafana: Check health

Safe

Returns version and database status. Handy for load balancer checks.

curl -s <grafana-url>/api/health
What each part does
  1. curl -sHTTP request, quiet
  2. <grafana-url>/api/healthunauthenticated health endpoint: database ok + version

Also known as: grafana down

Grafana: Reset the admin password

Caution

Run on the Grafana host/container when the admin login is lost.

grafana cli admin reset-admin-password <new-password>
What each part does
  1. grafana cliGrafana's command line (grafana-cli on older versions); run on the server
  2. admin reset-admin-passwordset a new password for the admin user directly in the database
  3. <new-password>the new password

Also known as: forgot admin password · grafana-cli

Grafana: Export a dashboard as JSON

Safe

Back up or version a dashboard. The uid is in the dashboard URL.

curl -s -H "Authorization: Bearer $GRAFANA_TOKEN" <grafana-url>/api/dashboards/uid/<dashboard-uid> | jq '.dashboard' > <dashboard-uid>.json
What each part does
  1. curl -sHTTP request, quiet
  2. -H "Authorization: Bearer $GRAFANA_TOKEN"authenticate with a service account token from an env var
  3. <grafana-url>/api/dashboards/uid/<dashboard-uid>the dashboard (UID is in the dashboard URL)
  4. | jq '.dashboard'keep the dashboard model, drop the meta block
  5. > <dashboard-uid>.jsonsave it to a file
  • #grafana
  • #backup

Also known as: dashboard json · dashboards as code

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…