Grizzly supports a number of workflows.
All examples so far have described Grizzly interacting with resources represented as static resources in YAML. This is the simplest use-case for Grizzly, but there are more powerful workflows available.
grr pull -d and
grr apply -d it is possible to migrate dashboards between
Grafana instances. To pull dashboards and folders from one instance to another
is as simple as:
$ export GRAFANA_URL=<...source Grafana URL...> $ grr pull -d resources -t "Dashboard/*" -t "DashboardFolder/*"
This asks Grizzly to pull all resources matching the
<kind>/<UID> pattern for
dashboards and folders into a directory called
Note: Grizzly can pull datasources, but secure passwords won’t be included when pulled - these will need to be provided manually (either by editing into the downloaded YAML or pasting them in via the Grafana UI).
To push them to a new Grafana instance:
$ export GRAFANA_URL=<...destination Grafana URL...> $ grr apply -d resources
The most powerful workflow for Grizzly involves Jsonnet, a powerful programming language that can be used to render JSON or YAML.
With this workflow, resources are described in Jsonnet. When Grizzly is invoked, it evaluates the Jsonnet and renders the resources into JSON/YAML. This it can then push to the relevant systems.
For more information see the Jsonnet page.
Full Command List
Retrieves a resource from the remote system, via its UID. Its UID will be two parts separated by a dot,
<resource-type>.<resource-id>. A dashboard might be
$ grr get Dashboard.my-uid
List all resources found after executing Jsonnet file.
$ grr list my-lib.libsonnet
Shows the resources found after executing Jsonnet, rendered as expected for each resource type:
$ grr show my-lib.libsonnet
Compares each resource rendered by Jsonnet with the equivalent on the remote system:
$ grr diff my-lib.libsonnet
Uploads each dashboard rendered by the mixin to Grafana
$ grr apply my-lib.libsonnet
Watches a directory for changes. When changes are identified, the jsonnet is executed and changes are pushed to remote systems. The directory is watched recursively (i.e. all subdirectories are watched too), but if new subdirectories are added, watch command needs to be re-started, as new directories will not be picked up automatically.
This example watches the current directory for changes, then executes and applies
my-lib.libsonnet when changes are noticed:
$ grr watch . my-lib.libsonnet
Renders Jsonnet and saves resources as files directory which is specified with the second argument.
These resources can then be deployed This can be used with Grafana Provisioning to provision dashboards that can be picked up immediately by Grafana.
$ grr export some-mixin.libsonnet my-provisioning-dir
When a backend supports preview functionality, this renders Jsonnet and uploads previews to endpoint systems.
At present, only Grafana dashboards are supported. With Grafana, it produces dashboard snapshots. It then prints out links for each snapshot that was uploaded.
$ grr preview my-lib.libsonnet
Grafana snapshots by default do not expire. Expiration can be set via the
-e, --expires flag which takes a number of seconds as an argument.
-t, --target strings
It allows the targeting of resources by key, where key is in the form
grr list to get a list of resource keys in your code.
It allows the targeting folder containing jsonnet library to include, should be repeated multiple times.
If not specified it include
lib and local dir (
.) folders by default.