grafana-import: Import and export Grafana dashboards


grafana-import is a program for elegantly importing and exporting Grafana dashboards using the Grafana HTTP API. It is based on grafana-client, and supports dashboard-as-code workflows.


  • Export dashboards into JSON format.
  • Import dashboards into Grafana, both in native JSON format, or emitted by dashboard builders, supporting dashboard-as-code workflows.
    • Supported builders are Grafonnet, grafana-dashboard, grafanalib, and any other executable program which emits Grafana Dashboard JSON on STDOUT.
    • The import action preserves the version history of dashboards.
  • Watchdog: For a maximum of authoring and editing efficiency, the watchdog monitors the input dashboard for changes on disk, and re-uploads it to the Grafana API, when changed.
  • Remove dashboards.



pip install --upgrade 'grafana-import[builder] @ git+'


This procedure outlines an almost optimal dashboard-as-code workflow, with no JSON in sight, where the dashboard is defined by Python code, using grafana-dashboard. The input dashboard will be monitored for changes on disk, and re-uploaded to the Grafana API each time when changed.

# Prepare a dashboard.
# Define the URL to your Grafana instance.
export GRAFANA_URL=http://admin:admin@localhost:3000
# Start the program in watchdog mode.
grafana-import import --overwrite --reload -i

Of course, you can also use the program to upload dashboards in traditional Grafana Dashboard JSON format, with or without watchdog mode.

grafana-import import -i native-play-influxdb.json