Enterprise Open source Grafana Cloud

Export non-provisioned resources from Grafana

Caution

Git Sync is available in public preview for Grafana Cloud, and is an experimental feature in Grafana v12 for open source and Enterprise editions. Documentation and support is available based on the different tiers but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.

Git Sync is under development. Refer to Usage and performance limitations for more information. Contact Grafana for support or to report any issues you encounter and help us improve this feature.

Git Sync is under development, and traditional operations like moving or copying a dashboard to a provisioned folder are not fully supported for resources already existing in Grafana. Git Sync doesn’t offer any built-in functionality to easily export resources from Grafana in bulk. However, the following options are available:

Add an existing dashboard from the Grafana UI

You can save a copy of dashboard directly from the Grafana UI to your provisioned folder.

To do so, follow these steps:

  1. Make sure the dashboard is in Editable mode.
  2. Select Save or Save as from the top-right corner.
  3. In the menu:
    • Target folder: Select the provisioned folder from your Grafana UI where you want to save the dashboard in.
    • Branch: Type in the name of the branch of the provisioned repository you want to work in, or create a new branch. Committing directly to main is not supported.
    • Folder: Type in the folder in your sync repository, if any.
    • Fill in the rest of the fields accordingly.
  4. Click Save.
  5. In your synced GitHub repository, merge the branch with the dashboard you want to sync.

Add a dashboard with Grafana CLI

You can also export an existing dashboard with the Grafana CLI. Use the CLI to download the resources you want to sync from Grafana, and then commit and push those files to your provisioned Git repository. Git Sync will then detect the commit, and synchronize with Grafana.

To do so, follow these steps:

  1. Set up the grafanactl context to point to your instance as documented in Defining contexts.
  2. Pull the resources you want to sync from the instance to your local repository:
grafanactl resources pull dashboards --path <REPO_PATH>

Next, commit and push the resources to your Git repository:

git add <DASHBOARDS_PATH>
git commit -m "Add dashboards from Grafana"
git push

Where:

  • <GIT_REPO>: The path to the repository synced with Git Sync
  • <DASHBOARDS_PATH>: The path where the dashboards you want to export are located. The dashboards path must be under the repository

See more at Manage resources with Grafana CLI.

Add a dashboard via JSON export

To add an existing dashboard to Git Sync via JSON export, you need to:

  1. Export the dashboard as JSON.
  2. Convert it to the Custom Resource Definition (CRD) format required by the Grafana App Platform.
  3. Commit the converted file to your Git repository.

Required JSON format

To export a dashboard as a JSON file it must follow this CRD structure:

YAML
{
  'apiVersion': 'dashboard.grafana.app/v1beta1',
  'kind': 'Dashboard',
  'metadata': { 'name': 'dcf2lve9akj8xsd' },
  'spec': { /* Original dashboard JSON goes here */ },
}

The structure includes:

  • apiVersion: Specifies the API version (currently v1beta1)
  • kind: Identifies the resource type (Dashboard)
  • metadata: Contains the dashboard identifier uid. You can find the identifier in the dahsboard’s URL or in the exported JSON
  • spec: Wraps your original dashboard JSON

Work with Git-managed dashboards

After you’ve saved a dashboard in Git, it’ll be synchronized automatically, and you’ll be able to work with it as any other provisioned resource. Refer to Work with provisioned dashboards for more information.