Skip to content

Instantly share code, notes, and snippets.

@brianlow
Created August 30, 2014 21:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianlow/aaef0d5144db74317d48 to your computer and use it in GitHub Desktop.
Save brianlow/aaef0d5144db74317d48 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
# Saves all dashboards in Kibana to /vagrant/dashboards
# so they can be reloaded if this vagrant instance is destroyed
#
curl -s 'http://localhost:9200/kibana-int/dashboard/_search?pretty=true&fields=' | grep "_id" | sed -E 's/.*"_id" : "(.*)",/\1/' | while read -r line; do curl -s -X GET http://localhost:9200/kibana-int/dashboard/$line/_source > /vagrant/dashboards/$line.json; done
#!/usr/bin/env bash
#
# Loads previously saved Kibana dashboards from /vagrant/dashboards into the current Elasticsearch instance
#
for file in /vagrant/dashboards/*.json
do
filename=$(basename $file)
name=${filename%.*}
curl -X PUT http://localhost:9200/kibana-int/dashboard/${name} -T /vagrant/dashboards/${filename} --silent
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment