Tools to make Grafana dashboards from templates
Go to file
Clark Boylan fda05305bd Move from testr to stestr
Running `python setup.py test` and similar commands is no longer
supported by setuptools. These rely on testr anyway which has been
replaced by stestr in most places. Just switch to using stestr to avoid
these problems.

Note that we drop the coverage tox target since that requires a bit more
effort to setup now, but this was not used in CI and probably isn't
super important for a tool like grafyaml. It can be added back in if a
need arises in the future.

Change-Id: I86039d1d143b0199285d9195a3582640d447b36e
2023-09-19 11:06:17 -07:00
doc/source Add import of json files 2020-06-25 15:04:14 +10:00
etc Replace oslo_config dependency with argparse 2015-10-09 10:12:57 -04:00
grafana_dashboards Fix default handling with newer voluptious 2022-10-14 16:35:05 -07:00
tests Strip id/uid from .json input 2022-03-11 13:38:45 +11:00
.coveragerc Change ignore-errors to ignore_errors 2015-09-21 14:23:17 +00:00
.gitignore Update .gitignore to vim temporary files 2015-10-20 21:59:05 -04:00
.gitreview OpenDev Migration Patch 2019-04-19 19:26:03 +00:00
.mailmap Initial Cookiecutter Commit. 2015-05-04 13:14:07 -04:00
.stestr.conf Move from testr to stestr 2023-09-19 11:06:17 -07:00
.testr.conf Initial Cookiecutter Commit. 2015-05-04 13:14:07 -04:00
.zuul.yaml Revert "Migrate grafyaml container images to quay.io" 2023-05-24 13:50:08 -07:00
CONTRIBUTING.rst Initial Cookiecutter Commit. 2015-05-04 13:14:07 -04:00
Dockerfile Revert "Migrate grafyaml container images to quay.io" 2023-05-24 13:50:08 -07:00
HACKING.rst Initial Cookiecutter Commit. 2015-05-04 13:14:07 -04:00
LICENSE Initial Cookiecutter Commit. 2015-05-04 13:14:07 -04:00
MANIFEST.in Initial Cookiecutter Commit. 2015-05-04 13:14:07 -04:00
openstack-common.conf Initial Cookiecutter Commit. 2015-05-04 13:14:07 -04:00
README.rst Add import of json files 2020-06-25 15:04:14 +10:00
requirements.txt Update Docker images to python 3.10 2022-10-14 16:36:05 -07:00
setup.cfg Update Docker images to python 3.10 2022-10-14 16:36:05 -07:00
setup.py Drop Python 2 support 2020-06-24 11:52:23 +10:00
test-requirements.txt Move from testr to stestr 2023-09-19 11:06:17 -07:00
tox.ini Move from testr to stestr 2023-09-19 11:06:17 -07:00

grafyaml

At a glance

Overview

grafyaml takes descriptions of Grafana dashboards in YAML format, and uses them to produce JSON formatted output suitable for direct import into Grafana.

The tool uses the Voluptuous data validation library to ensure the input produces a valid dashboard. Along with validation, users receive the benefits of YAML markup such as comments and clearer type support.

For example, here is a minimal dashboard specification

dashboard:
  time:
    from: "2018-02-07T08:42:27.000Z"
    to: "2018-02-07T13:48:32.000Z"
  templating:
    - name: hostname
      type: query
      datasource: graphite
      query: node*
      refresh: true
  title: My great dashboard
  rows:
    - title: CPU Usage
      height: 250px
      panels:
          - title: CPU Usage for $hostname
            type: graph
            datasource: graphite
            targets:
              - target: $hostname.Cpu.cpu_prct_used

grafyaml can be very useful in continuous-integration environments. Users can specify their dashboards via a normal review process and tests can validate their correctness.

The tool can also take JSON manually exported from the Grafana interface and load it as a dashboard. This allows keeping dashboards that have been edited with the inbuilt editor externally version controlled.

A large number of examples are available in the OpenStack project-config repository, which are used to create dashboards on http://grafana.openstack.org.