GithubHelp home page GithubHelp logo

klaus385 / grafana-backup-tool Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ysde/grafana-backup-tool

0.0 1.0 0.0 48 KB

Python codes to dump or create dashboards and datasources from Grafana using it's API

License: MIT License

Dockerfile 1.70% Shell 11.01% Python 87.30%

grafana-backup-tool's Introduction

Grafana Dashboard Backup Tool

A Python-based application to backup Grafana settings via Grafana API.

Requirements

  • bash
  • python 2.7, python 3.x with requests library installed (pip install requests ?)
  • access to a Grafana 3.0 API server

Configuration

gafana-backup-tool uses environment variables to define the connection to a Grafana server, or alternatively hard-coded settings in src/grafanaSettings.py. You need to add the following to your .bashrc or execute once before using the tool:

export GRAFANA_URL=http://some.host.org:3000/
export GRAFANA_TOKEN=eyJrIjoidUhaU2ZQQndrWFN3RRVkUnVfrT56a1JoaG9KWFFObEgiLCJuIjoiYWRtaW4iLCJpZCI6MX0=

There is official documentation how to obtain the TOKEN for your installation.

How to Use

  • First perform Configuration as described above.
  • Use backup_grafana.sh to backup all your dashboards, datasources and folders to the _OUTPUT_ subdirectory of the current directory. For example:
$ ./backup_grafana.sh
$ tree _OUTPUT_
_OUTPUT_/
└── 2019-05-13T08:48:03.tar.gz
  • Use restore_grafana.sh with a path to a previous backup to restore everything. NOTE this may result in data loss, by overwriting data on the server.

Docker

Replace variables below to use docker version of this tool

  • {YOUR_GRAFANA_TOKEN}: Your grafana site token.
  • {YOUR_GRAFANA_URL}: Your grafana site url.
  • {YOUR_BACKUP_FOLDER_ON_THE_HOST}: The backup folder on the host machine.
docker run --rm --name grafana-backup-tool \
   -e GRAFANA_TOKEN={YOUR_GRAFANA_TOKEN} \
   -e GRAFANA_URL={YOUR_GRAFANA_URL} \
   -v {YOUR_BACKUP_FOLDER_ON_THE_HOST}:/opt/grafana-backup-tool/_OUTPUT_  \
   ysde/docker-grafana-backup-tool

Notes

  • Please have a look at the two scripts in the root directory if you need to customize something.

grafana-backup-tool's People

Contributors

ysde avatar thinrope avatar the-smooth-operator avatar danrue avatar dmitriy-kharchenko avatar gustavosoares avatar rdoering avatar

Watchers

James Cloos 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.