This tool is based on ysde/grafana-backup-tool version 1.4.2.
- Backup all of the Grafana components
- By local storage and AWS S3
- Restore all of the Grafana components
- By local storage or AWS S3
- Restore a specific dashboard's JSON.
- By only local storage
- Folder
- Folder Permissions
- Library Elements (doesn't work with Grafana 8.0.0 but 8.4.3)
- Dashboard (contains Alert)
- Datasource
- Alert Channel
- Alert Rules (Supported in version 9.4.0 of grafana and up.)
- Teams
- Team Members (Needs Basic Authentication (username and password, see grafana doc)
- You need to set
Admin's account and password
ingrafanaSettings.json
, or set the base64 encodedadmin account and password
in ENVGRAFANA_BASIC_AUTH
. E.gexport GRAFANA_BASIC_AUTH=YWRtaW46YWRtaW4=
- Or Sets this ENV of the Grafana server
GF_USERS_ALLOW_ORG_CREATE=true
. see grafana doc
- You need to set
- Organization (Needs Basic Authentication (username and password, see grafana doc)
- You need to set
Admin's account and password
ingrafanaSettings.json
, or set the base64 encodedadmin account and password
in ENVGRAFANA_BASIC_AUTH
. E.gexport GRAFANA_BASIC_AUTH=YWRtaW46YWRtaW4=
- Or Sets this ENV of the Grafana server
GF_USERS_ALLOW_ORG_CREATE=true
. see grafana doc
- You need to set
- User (Needs Basic Authentication (username and password, see grafana doc)
- You need to set
Admin's account and password
ingrafanaSettings.json
, or set the base64 encodedadmin account and password
in ENVGRAFANA_BASIC_AUTH
. E.gexport GRAFANA_BASIC_AUTH=YWRtaW46YWRtaW4=
- Grafana's api doesn't provide user's password when backing up, so the
default_user_password
ingrafanaSettings.json
, or in ENVDEFAULT_USER_PASSWORD
, E.gexport DEFAULT_USER_PASSWORD=supersecret
will be used when restoring.
- You need to set
- Snapshots
- Dashboard Versions (only backup, no restore)
- Annotations
NOTE The only supported orgId
right now is 1
, the default organization will be backed up only!
- Build
make build
- Fill variables in
docker-compose.yml
file
cp docker-compose.yml.example docker-compose.yml
vim docker-compose.yml
- Start
docker compose up -d
There’s 3 features: backup all, restore all, restore dashboard’s JSON.
- Backup all of the Grafana components
- Backup file would be store in local storage and aws s3
curl localhost:9111/backup
- Restore all of the Grafana components
- Try restore all of Grafana components from local storage or AWS S3
curl -G localhost:9111/restore/all \
--data-urlencode archive="202501220533.tar.gz"
- Restore a specific dashboard's JSON
- Try restore a specific dashboard’s JSON from local storage
- Response of below command is dashboard’s JSON
curl -G http://localhost:9111/restore/dashboard \
--data-urlencode archive="202501220533.tar.gz" \
--data-urlencode title="Cosmos Validator"