10/07/2018 - LINUX
You can use commands and steps below to export and import Grafana dashboard and data source configurations.
While Dashboard is open, click "Share" icon on top of the page and select "Export" tab to save it to a JSON file.
While on Dashboard home page, click "Home" menu on the left top corner and select "Import dashboard" option to upload a JSON file.
Run command below in terminal.
$ curl -s "http://www.your-host.com/datasources" -u admin:grafana|jq -c -M '.[]'|split -l 1 - path/to/export/datasource/
Run command below in terminal.
$ for i in path/to/export/datasource/*; do \
curl -X "POST" "http://www.your-host.com/datasources" \
-H "Content-Type: application/json" \
--user admin:grafana \
--data-binary @$i
done