Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kristijorgji/grafana_impex
Grafana import export tool for folders, dashboards, datasources
https://github.com/kristijorgji/grafana_impex
backup-tool grafana migration-tool
Last synced: 27 days ago
JSON representation
Grafana import export tool for folders, dashboards, datasources
- Host: GitHub
- URL: https://github.com/kristijorgji/grafana_impex
- Owner: kristijorgji
- License: mit
- Created: 2021-04-26T14:29:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-01T22:09:13.000Z (over 3 years ago)
- Last Synced: 2024-09-28T15:41:05.804Z (about 1 month ago)
- Topics: backup-tool, grafana, migration-tool
- Language: TypeScript
- Homepage:
- Size: 264 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# grafana_impex
This is a grafana import/export tool that supports currently `grafana v7.1.4 (82a235b54c)`
And the following resources:
* Folders
* Datasources
* DashboardsCan be used also with `grafonnet` to first compile json resources, then proceed and import them to grafana.
## 1. Requirements
#### 1. Bash shell or NodeJS based on version used
#### 2. Only If you want to use `grafonnet`
If you want to use grafonnet for generating grafana json based on templates, then have to do the following steps
1. Clone in this dir the library grafonnet-lib, `git clone https://github.com/grafana/grafonnet-lib.git --depth=1`
2. install [jsonnet](https://github.com/google/jsonnet#packages)## 2a. How To Use (NodeJS Required)
First install the node package globally:
```shell
npm install -g [email protected]
```This will make available the command `gimpex` from all paths.
Then create a directory where you will store your grafana provisioning project.
```shell
mkdir grafana_provision
cd grafana_provision
```Copy `.env.dist` in this github repository to `.env` in your created dir above, and adjust the credentials for grafana connection and auth.
1. To export all resources like `datasources, folders, dashboards` from grafana instance:
```shell
gimpex export
```
![Demo](docs/images/export-demo.png)2. To import all resources to the instance specified in `.env`
```shell
gimpex import default
```Instead of `default` you can specify the environment which you used to export.
For example `ENV=prod gimpex export` will use env file `.env.prod` and export at `exported/prod` instead of `exported/default`
Then you can import from prod exported to current connection (specified in .env) like
```shell
gimpex import prod
```For adding secrets to datasources so they are fully configured during import see point 3.
## 2b. How To Use Only With Bash
See **[USE-WITH-BASH.md](docs/USE-WITH-BASH.md)**
## 3. Importing datasources with filled auth secrets
For this reason `jsonnet` is being used to compile templates to `json` filesSee `templates/datasources-credentials/example.jsonnet`
and `templates/secrets.example.json`Very easy and straightforward, the json you specify in datasource-credentials folder should have json format with name of datasource you want to fill with credential (you can check that form exported folder, exported/datasources), then based on the datasource type fill the secrets which are read from the secrets.json file that you can generate however you want and do not store in git or anywhere.
## 4. Contributing/Local Development
See **[LOCAL-DEVELOPMENT.md](docs/LOCAL-DEVELOPMENT.md)**
## 5. License
@Kristi Jorgji MIT
Released under the MIT Licence. See the bundled LICENSE file for details.