GDG has now introduced a new supporting tool that works in conjunction with GDG. It is currently dependent on the GDG
configuration
since it will operate on the currently selected context. You can confirm what the current context is by
running gdg tools ctx show
For example, my current output is as follows:
Most of the config isn’t that interesting, except the output_path will be used to determine where the newly generated
dashboards will be. Make sure you have a valid configuration before continuing.
There are use cases where an almost identical dashboard is needed except we need to replace certain parts of it.
For example, parts of a query need to be different, a different title, brand it to specific customer with a different
logo, or footer. All of these are difficult to control from grafana itself and even in the best case scenario it’s not
great user experience. This allows you to configure and generate a new dashboard with any set of variables and
dictionaries that you will seed to the tool.
The configuration that drives this application is templates.yml. You can see an example below.
One caveat. The “Keys” will all be lowercased due to how the data is being read in. Meaning, even though
Title is specified, the template will see the value under “title” instead.
As part of the installation you will have access to gdg-generate.
–config, –template-config, and -t are optional parameters. gdg-generate will fallback on defaults if
none are specified. If -t is not provided, all templates will be processed
Example output:
A new file has been created under test/data/org_2/dashboards/General/template_example.json