Created
May 7, 2021 05:01
-
-
Save xsqian/5d713f6b9ed58f903aa1c9be1b84807e to your computer and use it in GitHub Desktop.
how to export and import datasource from Grafana using Grafana API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p data_sources && curl -s "http://localhost:3000/api/datasources" -u admin:admin|jq -c -M '.[]'|split -l 1 - data_sources/ | |
for i in data_sources/*; do \ | |
curl -X "POST" "http://localhost:3000/api/datasources" \ | |
-H "Content-Type: application/json" \ | |
--user admin:admin \ | |
--data-binary @$i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment