GithubHelp home page GithubHelp logo

mystix / grafana-dashboard-manager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beam-connectivity/grafana-dashboard-manager

0.0 0.0 0.0 49 KB

Import and export Grafana dashboards for backup and dynamic provisioning

License: MIT License

Python 100.00%

grafana-dashboard-manager's Introduction

grafana-dashboard-manager

CodeQL

Introduction

A simple CLI utility for importing or exporting dashboard JSON definitions using the Grafana HTTP API.

This can be used for:

  • Backing up your dashboards that already exist within your Grafana instance, e.g. if you are migrating from the internal SQLite database to MySQL.
  • Updating dashboard files for your Infrastructure-as-Code for use with Grafana dashboard provisioning.
  • Making tweaks to dashboard JSON files directly and updating Grafana with one command.

Features

  • Mirrors the folder structure between a local set of dashboards and Grafana, creating folders where necessary.
  • Ensures links to dashboards folders in a dashlist Panel are consistent with the Folder IDs - useful for deploying one set of dashboards across multiple Grafana instances, for instance across environments.

Workflow

The intended workflow is:

  1. Create a dashboard and save it in the desired folder from within the Grafana web GUI
  2. Use grafana-dashboard-manager to extract the new dashboards and save them to a local directory or version control system.
  3. Dashboards can be created or updated from the local store and uploaded back into Grafana.

Installation

Install via pip:

pip install grafana-dashboard-manager

Install from source - requires Poetry on your system:

cd /path/to/grafana-dashboard-manager
poetry install

Usage

Credentials

It is important to note that the admin login username and password are required, and its selected organization must be correct, if you are accessing the API using --username and --password. Alternatively, the API Key must have admin permissions if you are accessing the API using --token.

For more help, see the full help text with poetry run grafana-dashboard-manager --help.

Download dashboards from web to solution-data using the Grafana admin user

poetry run grafana-dashboard-manager \
    --host https://my.grafana.com \
    --username admin_username --password admin_password \
    download all \
    --destination-dir /path/to/dashboards/

Download dashboards from web to solution-data using a Grafana admin API Key

poetry run grafana-dashboard-manager \
    --host https://my.grafana.com \
    --token admin_api_key \
    download all \
    --destination-dir /path/to/dashboards/

Upload dashboards from solution-data to web using the Grafana admin user

poetry run grafana-dashboard-manager \
    --host https://my.grafana.com \
    --username admin_username --password admin_password \
    upload all \
    --source-dir /path/to/dashboards/

Upload dashboards from solution-data to web using a Grafana admin API Key

poetry run grafana-dashboard-manager \
    --host https://my.grafana.com \
    --token admin_api_key \
    upload all \
    --source-dir /path/to/dashboards/

Please note: if your Grafana is not hosted on port 80/443 as indicated by the protocol prefix, the port needs to be specified as part of the --host argument. For example, a locally hosted instance on port 3000: --host http://localhost:3000.

Limitations

  • The home dashboard new deployment needs the default home dashboard to be manually set in the web UI, as the API to set the organisation default dashboard seems to be broken, at least on v8.2.3.
  • Currently expects a hardcoded home.json dashboard to set as the home.
  • Does not handle upload of dashboards more deeply nested than Grafana supports.
  • Does not support multi-organization deployments.

grafana-dashboard-manager's People

Contributors

chan-vince avatar christianwitts avatar lawrencewarren avatar meetmatt avatar mstyushin avatar vitosans avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.