A Go tool for backing up Grafana components (dashboards, folders, data sources, etc.).
⚠️ Project under development – use with caution in production.
The easiest way to install is to download the latest release from the GitHub
Releases page and extract the gops binary:
# Linux/x86_64 example
curl -LO https://github.com/aristidesneto/grafana-ops/releases/latest/download/gops_Linux_x86_64.tar.gz
tar -xzf gops_Linux_x86_64.tar.gz
chmod +x gops
mv gops /usr/local/bin/ # or another directory on your PATHFor other platforms, see Releases.
🧰 Development alternative: if you prefer to build locally, the repository includes a
Makefilethat usesgoreleaser. Runmake deps && make buildand the binary will be placed indist/.
The utility accepts options from multiple sources, in the following order of precedence:
- Command‑line flags
- Environment variables
- YAML configuration file
gops save \
--grafana-url https://grafana.example.com \
--grafana-token "mytoken" \
--output ./backup \
--loglevel debugYou can configure Grafana Ops using environment variables instead of flags. All variables must be prefixed with GO_.
export GO_GRAFANA_URL=https://grafana.example.com
export GO_GRAFANA_TOKEN=mytoken
export GO_OUTPUT=./backup
export GO_LOGLEVEL=info
# run without flags
gops save| Flag | Environment Variable | Default |
|---|---|---|
--grafana-url |
GO_GRAFANA_URL |
|
--grafana-token |
GO_GRAFANA_TOKEN |
|
--output |
GO_OUTPUT |
./_output |
--loglevel |
GO_LOGLEVEL |
info |
The file is YAML and can be passed with --config or -c. Example config.yaml:
# config.yaml
grafana-url: https://grafana.example.com
grafana-token: "mytoken"
output: ./backup
loglevel: infogops save --config /path/to/config.yamlBy default the program looks for config.yaml in ./ and
~/.gops if you don’t specify a file.
- Full backup using flags:
gops save --grafana-url https://grafana.example.com \
--grafana-token mytoken \
--output ./backupFeel free to open pull requests, report issues or suggest improvements.
This project is licensed under the Apache License 2.0 – see the LICENSE file for details.