← Projects

Grafana dashboards as code

Data ·

Grafana dashboards versioned in git and synced over the API: dry-run diff, idempotent apply, round-trip pull of existing dashboards.

  • Python
  • Grafana API
  • Docker
  • pytest

The problem

Dashboards edited by hand in the UI drift: no review, no history, no way to tell who changed a panel.

What it does

A small command-line tool that treats a folder of JSON files in git as the source of truth, modelled on terraform plan and apply:

  • diff shows what would change without touching anything, and in CI it can fail a pipeline when dashboards drift from the repo;
  • apply brings the server to the state of the files, and a second run changes nothing;
  • pull brings existing dashboards back into git.

It comes from a tool I use to keep the monitoring dashboards of a device fleet under version control.