A small helper for Grafana
Use API token to authenticated:
grafana-tool COMMAND --grafana-url http://foo.bar:3000 --api-token eyJrIjoieVBIMnIzTVl0YlFWbFlBckN==
Use user and password to authenticated:
grafana-tool COMMAND --grafana-url http://foo.bar:3000 --user john --password mylittlesecret
If you don’t want to pollute your command line, or if don't want that your sensitive data are show up in the history or log, it’s a good idea to use environment variables to authenticated:
GRAFANA_URL="http://foo.bar:3000"
GRAFANA_API_TOKEN="eyJrIjoieVBIMnIzTVl0YlFWbFlBckN=="
grafana-tool COMMAND
Export all dashboards:
grafana-tool dashboard export --grafana-url http://foo.bar:3000 --api-token eyJrIjoieVBIMnIzTVl0YlFWbFlBckN== --path ~/backup
Export all dashboards of a folder:
grafana-tool dashboard export --grafana-url http://foo.bar:3000 --api-token eyJrIjoieVBIMnIzTVl0YlFWbFlBckN== --path ~/backup --folder devBot
Grafana Tool requires golang version go1.11 or newer, the Makefile requires GNU make.
- Install Go >=go1.11
- Install dep ==v0.5.0
- Download Grafana Tool source:
go get -d github.com/LStuker/grafana-tool
- Run build from the source directory
go build main.go
docker run -it lstuker/grafana-tool:0.0.1
or build your own:
git clone github.com/lstuker/grafana-tool
docker build .
View the changelog for the latest updates and changes by version.