Grafana Dashboard Manager

Grafana dash-n-grab

Grafana Dash-n-Grab (GDG) -- Dashboard/DataSource Manager. The purpose of this project is to provide an easy to use CLI to interact with the grafana API allowing you to backup and restore dashboard and datasources.

Getting started

This project requires Go to be installed. On OS X with Homebrew you can just run brew install go.

Configuring Auth

make a copy of conf/importer-example.yml and name it conf/importer.yml You'll need administrative privileges to proceed.

You can use either an Auth Token or username/password credentials. If you configure both then the Token is given priority.

Watched folders under grafana is a white list of folders that are being managed by the tool. By default only "General" is managed.

env.output defines where the files will be saved and imported from.

Contexts

Starting with version 0.1.4 contexts are now supported. Your config can contain one or multiple contexts which are essentially a grafana server configuration.

ctx is shorthand for context

./bin/grafana-dashboard-manager ctx list -- Lists all known contexts
./bin/grafana-dashboard-manager ctx show -c qa -- shows the configuration for the selected context
./bin/grafana-dashboard-manager ctx set -c production -- updates the active config and sets it to the request value.

Users

Only supported with basic auth. Users is the only one where basic auth is given priority. API Auth is not supported, so will try to use basic auth if configured otherwise will warn the user and exit.

./bin/grafana-dashboard-manager users list -- Lists all known users
./bin/grafana-dashboard-manager users promote -u [email protected] -- promotes the user to a grafana admin

Running the app

Running it then should be as simple as:

$ make build
$ ./bin/grafana-dashboard-manager

Every namespace has three functions: list, import, export, clear operating on only the monitored folders.

Dashboards

All commands can use dashboards or dash to manage dashboards

./bin/grafana-dashboard-manager dash list -- Lists all current dashboards
./bin/grafana-dashboard-manager dash import -- Import all dashboards from grafana to local file system
./bin/grafana-dashboard-manager dash export -- Exports all dashboard from local filesystem (matching folder filter) to Grafana
./bin/grafana-dashboard-manager dash clear -- Deletes all dashboards

DataSources

DataSources credentials are keyed by the name of the DataSource. See see config example. If the datasource JSON doesn't have auth enabled, the credentials are igored. If Credentials are missing, we'll fall back on default credentials if any exist. The password is set as a value for basicAuthPassword in the API payload.

All commands can use datasources or ds to manage datasources

./bin/grafana-dashboard-manager ds list -- Lists all current datasources
./bin/grafana-dashboard-manager ds import -- Import all datasources from grafana to local file system
./bin/grafana-dashboard-manager ds export -- Exports all dashboard from local filesystem (matching folder filter) to Grafana
./bin/grafana-dashboard-manager ds clear -- Deletes all datasources

Making a release

Install goreleaser.

brew install goreleaser/tap/goreleaser
brew reinstall goreleaser`

export your GITHUB_TOKEN.

export GITHUB_TOKEN="secret"

git tag v0.1.0 goreleaser release

Comments
  • Add CI/CD for building and pushing docker image to the public registry on release

    Add CI/CD for building and pushing docker image to the public registry on release

    Is your feature request related to a problem? Please describe. For using GDG in docker I should build and store images by myself

    Describe the solution you'd like Better to create a public docker registry with images by versions in it, it will be very useful for fast CLI usage via docker, and in helm charts/k8s clusters. This repository already has CI/CD for releasing new versions and a pretty good docker image, let's add a new docker release target in CI/CD process by building and pushing the image to the public docker registry (GitHub, DockerHub)

  • Support importing Grafana panels

    Support importing Grafana panels

    Apparently, Grafana does not plan to support importing library panels through POST API and they want people to use import dashboard API that is not documented.

    https://github.com/grafana/grafana/issues/44003 https://github.com/grafana/grafana/pull/43525

    It would be great if you could use that import API to support that feature.

    I was planning on writing PR, but currently have busy schedule.

  • Configuration with environment variables

    Configuration with environment variables

    It would be nice if we could specify environment variables in the configuration file importer.yml

    This will enable us to isolate secrets (tokens and passwords), and safely commit the configuration file to version control.

  • Auth Token or API key?

    Auth Token or API key?

    hi The authentication with Auth Token doesn't seem to work, even when created with Admin permission. Is it the API key I need to create or am I missing something here? Thanks a lot!

  • Authentication behind a https client certificate

    Authentication behind a https client certificate

    Our Grafana is running behind a self signed certificat.

    I get this error while executing dash list

    time="2021-11-29T13:39:10+01:00" level=warning msg="Error getting organizations: Get \"https://xxx.xxx/api/orgs\": local error: tls: no renegotiation"
    time="2021-11-29T13:39:10+01:00" level=fatal msg="Failed to retrieve dashboardsGet \"https://xxx.xxx/api/search?type=dash-db\": local error: tls: no renegotiation"
    
  • import export of a single dashboard

    import export of a single dashboard

    Hi @safaci2000 I think it would be useful to import and export a single dashboard. A use case can be to copy a single dashboard for one organization to another when you have a lot organization and don't want, or can't, copy all dashboards every time.

    gdg ctx set -c context_a
    gdg dashboard import my-dash
    gdg ctx set -c context_b
    gdg dashboard export my-dash
    

    Any idea is appreciated, I'm waiting of your feedback to start coding.

  • Use grafana sdk instead of a forked repo

    Use grafana sdk instead of a forked repo

    Hi @safaci2000 can you use https://github.com/grafana-tools/sdk instead of your forked repo https://github.com/netsage-project/sdk ? I think it's better for security reasons

  • Allow list / export / import / delete of Grafana alarms

    Allow list / export / import / delete of Grafana alarms

    Summary

    AFAIK currently there is no way to list / export / import / delete alerts set in Grafana. We would like to start exporting them so that we can have a back up in git.

    Features

    I would like to implement the following commands:

    ./gdg alerts list
    ./gdg alerts import
    ,/gdg alerts export
    ./gdg alerts clear
    

    Also, add a new block into the configuration file / parser. Something like:

    contexts:
      all:
        dashboards_output: "dashboards"
        alerts_output: "alerts"
    

    When exporting / importing, we would consider all of the alerts, just like with datasources. Meaning it would not be possible to export / import specific alerts.

    Notes

    • API documentation https://grafana.com/docs/grafana/latest/http_api/alerting/
    • I very much won't mind implementing this, but I will have time for this at best at the start of November. So I am creating an issue to first ask whether there are any plans for this, or whether by any chance you dont have a partial code for it already. :shrug:
  • export from specific local folder to grafana

    export from specific local folder to grafana

    Hi all,

    I have multiple grafana instances with many folders and wanna sync my folders from one dc to another. Can we have an option to import a folder from grafana at DC1 to my local folder dashboards/DC1 and then switch context to DC2 and export dashboards/DC1 to grafana at DC2? let me also say that I don't want to change output_path of dc2 to dashboards/DC1. I need it for example as an command line argument.

    Thanks in advance.

  • Support instances with more than 1000 dashboards

    Support instances with more than 1000 dashboards

    Thank you for this project!

    When listing/importing dashboards from a Grafana instance with more than 1000 dashboards, you only get the dashboards within the watched folder that were returned in the first 1000 results. As result, in my case I only imported 37 dashboards instead of all 225.

    I have no immediate need for this feature, but hopefully it could safe others some time or trouble in the short term.

  • [Docs] Added import / export examples

    [Docs] Added import / export examples

    Hi, you have a wonderful project!

    As I was using it, I found a few things that were not mentioned in the documentation, and which I thought would help me get to use your project much faster. So, I created this PR.

    Things I am trying to achieve:

    • Provide minimal configuration needed to import/export the dashboards; The importer-example.yml is great, but I wasn't sure what is needed, and which parts should be adjusted.
    • Mention of how the user will know if the things are working; Before, I wasn't 100% sure whether I need to also specify organization etc., and when I successfully printed the dashboards, I also got a log complaining about permissions, although that was just fine.
    • Showcase of the folder structure in case you are uploading; Before, I wasn't sure about the structure, and if there are some "prefix" folders in Grafana, so I hope this will make it explicit.

    I am very much open to any adjustments, this was more something I quickly wrote / copy pasted from my own documentation.

  • Team CRUD and Membership support

    Team CRUD and Membership support

    Create a full Team CRUD including associated members for a given team.

    • Ability to delete, save and recreate all teams.
    • Ability to recreate all the teams with any existing users associated with the given team.
    • Ability to list all the current teams.
  • CRUD notification channels

    CRUD notification channels

    Request for full CRUD support for notification channels was made, so adding a ticket to capture the request. Please vote up if you're also interested in this feature.

  • Add support to backup/restore alert rules

    Add support to backup/restore alert rules

    Problem: I use grafana alerting system where I put alert rules in grafana directly. I would like them also to be backed-up like everything else

    Solution: Having a way to backup alert rules like dashboards, datasources, etc

    alternatives: grafana alerts exporter. this is a bit basic though, and I already appreciate very much gdg. I would like to be able to use only gdg for both dashboards and alert rules

  • Update New Context Wizard

    Update New Context Wizard

    The wizard context is a bit outdated and hasn't been maintained with all the new features that have been added. It would be nice to take another pass to add support for the various new components like cloud support and such that have come in.

  • Wild card option for Dashboards

    Wild card option for Dashboards

    Hello gdg.. I could able to import and export the dashboards, it really helpful. But my concern is while creating a new context for importing, it asks "List the folders you wish to manage (example: folder1,folder2)? (Blank for General)?".Here manually i was entering the folder names (somewhat hectic). So is there any solution like wildcard which allows to select all the dashboard folders.

    expectation: could able to select all the dashboards rather giving multiple folder names

  • Support Sync contexts

    Support Sync contexts

    Is your feature request related to a problem? Please describe.

    Given two valid contexts, it would be nice to have the ability to synchronize a particular entity ie. dashboards between two contexts.

    Source context could use grafana instance or the storage system as an input while the destination should always be a grafana insurance.

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Example : gdg sync dashboards staging production gdg sync datasources --backup staging production

Grafana Dashboard Manager

Grafana dash-n-grab Grafana Dash-n-Grab (GDG) -- Dashboard/DataSource Manager. The purpose of this project is to provide an easy to use CLI to interac

Dec 31, 2022
grafana-sync Keep your grafana dashboards in sync.

grafana-sync Keep your grafana dashboards in sync. Table of Contents grafana-sync Table of Contents Installing Getting Started Pull Save all dashboard

Dec 14, 2022
Snowflake grafana datasource plugin allows Snowflake data to be visually represented in Grafana dashboards.
Snowflake grafana datasource plugin allows Snowflake data to be visually represented in Grafana dashboards.

Snowflake Grafana Data Source With the Snowflake plugin, you can visualize your Snowflake data in Grafana and build awesome chart. Get started with th

Dec 29, 2022
Grafana-threema-forwarder - Alert forwarder from Grafana webhooks to Threema wire messages

Grafana to Threema alert forwarder Although Grafana has built in support for pus

Nov 11, 2022
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)

Terraform Provider for Azure (Resource Manager) Version 2.x of the AzureRM Provider requires Terraform 0.12.x and later, but 1.0 is recommended. Terra

Oct 16, 2021
Multi cluster kubernetes dashboard with batteries included. Build by developers, for developers.

kubetower Multi cluster kubernetes dashboard with batteries included. Built by developers, for developers. Features Restart deployments with one click

Nov 28, 2022
:bento: Highly Configurable Terminal Dashboard for Developers and Creators
:bento: Highly Configurable Terminal Dashboard for Developers and Creators

DevDash is a highly configurable terminal dashboard for developers and creators who want to choose and display the most up-to-date metrics they need,

Jan 3, 2023
Simple Kubernetes real-time dashboard and management.
Simple Kubernetes real-time dashboard and management.

Skooner - Kubernetes Dashboard We are changing our name from k8dash to Skooner! Please bear with us as we update our documentation and codebase to ref

Dec 28, 2022
Kubernetes-native automatic dashboard for Ingress
Kubernetes-native automatic dashboard for Ingress

ingress-dashboard Automatic dashboard generation for Ingress objects. Features: No JS Supports OIDC (Keycloak, Google, Okta, ...) and Basic authorizat

Oct 20, 2022
Exporter your cypress.io dashboard into prometheus Metrics

Cypress.io dashboard Prometheus exporter Prometheus exporter for a project from Cypress.io dashboards, giving the ability to alert, make special opera

Feb 8, 2022
A beautiful CLI dashboard for GitHub 🚀
A beautiful CLI dashboard for GitHub 🚀

gh-dash ✨ A GitHub (gh) CLI extension to display a dashboard with pull requests and issues by filters you care about. Installation Install the gh CLI

Dec 30, 2022
Grafana Tempo is a high volume, minimal dependency distributed tracing backend.
Grafana Tempo is a high volume, minimal dependency distributed tracing backend.

Grafana Tempo is an open source, easy-to-use and high-scale distributed tracing backend. Tempo is cost-efficient, requiring only object storage to ope

Jan 8, 2023
Graph and alert on '.rrd' data using grafana, RRDTool and RRDSrv.

Grafana RRD Datasource A grafana datasource for reading '.rrd' files via RRDTool and RRDsrv. With this datasource you will be able to create grafana d

Oct 12, 2022
Download your Fitbit weight history and connect to InfluxDB and Grafana

WemonFit Weight monitoring for Fitbit, using InfluxDB and Grafana Generating a new certificate openssl req -new -newkey rsa:2048 -nodes -keyout lo

Oct 22, 2022
PoC for Grafana 8.x Local File Inclusion (Pre-Auth)

Grafana 8.x Local File Inclusion (Pre-Auth) CVE: Pending All credits go to j0v and his tweet https://twitter.com/j0v0x0/status/1466845212626542607 Dis

Nov 9, 2022
Grafana Unauthorized arbitrary file reading vulnerability
Grafana Unauthorized arbitrary file reading vulnerability

CVE-2021-43798 Grafana Unauthorized arbitrary file reading vulnerability 8.3.1 (2021-12-07) Security: Fixes CVE-2021-43798 . For more information, see

Dec 25, 2022
Grafana DB2 Data Source Backend Plugin

Grafana DB2 Data Source Backend Plugin This template is a starting point for building Grafana Data Source Backend Plugins What is Grafana Data Source

Dec 13, 2021
Otus prometheus grafana for golang

HW Prometheus. Grafana Clone the repo: git clone https://github.com/alikhanmurzayev/otus_kuber_part_3.git && cd otus_kuber_part_3 Prepare workspace: m

Dec 17, 2021
Cole - Cole can use his sixth sense to give you metrics about your Grafana dashboards

Cole Cole can use his sixth sense to give you metrics about your Grafana dashboa

Nov 9, 2022