Package: grafana_dashboard_manager
grafana-dashboard-managerA simple CLI utility for importing and exporting dashboards as JSON using the Grafana HTTP API.This can be used for:Backing up your dashboards that already exist within your Grafana instance, e.g. if you are migrating from the internal SQLite database to MySQL.Updating dashboard files for your Infrastructure-as-Code for use withGrafana dashboard provisioning.Making tweaks to dashboard JSON files directly and updating Grafana with one command.FeaturesMirrors the folder structure between a local set of dashboards and Grafana, creating folders where necessary.Ensures links to dashboards folders in adashlistPanel are consistent with the Folder UIDs - useful for deploying one set of dashboards across multiple Grafana instances, for instance across environments.UsageFor detailed command help, see the full help text with the--helpoption.CredentialsIt is important to note that theadminlogin username and password are required, and its selected organization must be correct, if you are accessing the API using--usernameand--password. Alternatively, a provided API Key must haveadminpermissions if you are accessing the API using--token.DockerA Dockerfile is provided. To build and run:dockerbuild-tgrafana-dashboard-manager:latest.
dockerrungrafana-dashboard-manager--helpFrom PyPIInstall viapip:pipinstallgrafana-dashboard-managerFrom sourceInstall dependencies and run withPoetrycd/path/to/grafana-dashboard-manager
poetryinstall
poetryrunpython./grafana_dashboard_manager--helpWorkflowThe intended workflow is:Download dashboards and to a local directory or version control system for backup and change control.Replicate across multiple Grafana installs or restore a previous install by uploading the saved dashboards.Usage ExamplesThese examples usedocker runcommands, but the commands are the same regardless of run method.Download dashboards using the Grafana admin user:dockerrungrafana-dashboard-manager\download\--schemehttps\--hostmy.grafana.example.com\--username$USERNAME--password$PASSWORD\--destination/path/to/dashboards/Download dashboards using a Grafana admin API Key:dockerrungrafana-dashboard-manager\download\--schemehttps\--hostmy.grafana.example.com\--token$API_KEY\--destination/path/to/dashboards/Upload dashboards using the Grafana admin user, to a local instance for testingdockerrungrafana-dashboard-manager\upload\--schemehttp\--port3000\--hostlocalhost\--username$USERNAME--password$PASSWORD\--source/path/to/dashboards/Upload dashboards using a Grafana admin key without any user prompts:dockerrungrafana-dashboard-manager\upload\--schemehttp\--port3000\--hostlocalhost\--token$API_KEY\--source/path/to/dashboards/NotesThe scheme ishttpsand port is 443 by default. If your Grafana is not hosted with https on 443, the scheme and port needs to be specified using the--schemeand--portoptions respectively.If you use self signed certs on the Grafana server or otherwise don't want to validate an HTTPS connection, use--skip-verifyalthough this is not recommended.Theversionof the dashboard is removed of the json files in order to allow overwriting and creation of dashboards as new.URL encoding of strings is handled by httpx and so characters such as/in folder names is supported.When uploading, setting the home dashboard from thehome.jsonfile can be disabled with the option--skip-home.LimitationsDoes not support the experimental nested folders in Grafana. Only one level of folders is supported.Does not support multi-organization deployments.