Graaf
Graaf is a Go program that translates simple dashboards written in YAML to Grafana JSON. It has an extensive manual page that explains its usage. This is also known as Grafana as code, but then for real.
The following is a dashboard with 4 panels that I use for my own monitoring.
This dashboard is 47 lines, the generated JSON dashboard is 500 lines, a ~10-fold reduction in cruft. Not bad!
Configure Grafana⌗
In the graaf(1) manual page it is explained how to configure Grafana, so that graaf(1) will actually work. Repeated here for easier search indexing.
For Grafana to work you only may use OrgID 1 and provision the datasource and dashboards via the following YAML config:
In .../provisioning/dashboards/dashboards.yaml
, put:
And save the output of graaf
in /var/lig/grafana/dashboards. Next configure a datasource in
../provisioning/datasources/prometheus.yaml
:
For good measure erase the grafana database: rm /var/lib/grafana/grafana.db
and restart grafana.
If you want to set a default ‘home’ dashboard use:
in /etc/grafana/grafana.ini
.