Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkashyap1707/df947a55071d8311dd2e8f88e58e32b1 to your computer and use it in GitHub Desktop.
Save kkashyap1707/df947a55071d8311dd2e8f88e58e32b1 to your computer and use it in GitHub Desktop.
Command to export all grafana 2 dashboard to JSON using curl
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment