Skip to content

Instantly share code, notes, and snippets.

@WarFox
Last active October 14, 2016 14:46
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 WarFox/b0559c25efbd5737d47995c60eea5ce4 to your computer and use it in GitHub Desktop.
Save WarFox/b0559c25efbd5737d47995c60eea5ce4 to your computer and use it in GitHub Desktop.
Install Kibana on multiple remote servers.
#!/usr/bin/env bash
kibana_nodes=(server1 server2 server3)
elasticsearch_url=http://myelasticsearch.com
function install_kibana {
echo "install kibana"
sudo rpm -i https://download.elastic.co/kibana/kibana/kibana-4.6.1-x86_64.rpm
}
function install_timelion {
echo "install timelion"
sudo /opt/kibana/bin/kibana plugin -i elastic/timelion
}
function install_sense {
echo "install sense"
sudo /opt/kibana/bin/kibana plugin -i elastic/sense
}
function update_elasticsearch_url {
echo "update elasticsearch url"
sed -i "s/elasticsearch.url: http:\/\/localhost:9200\//elasticsearch.url: ${elasticsearch_url}" /opt/kibana/conf/kibana.yml
}
function restart_kibana {
sudo service kibana restart
}
function install_kibana_on_nodes {
echo "install kibana on nodes"
for node in "${kibana_nodes[@]}"
do
echo $node
ssh ec2-user@$node "$(typeset -f); install_kibana; install_timelion; install_sense; update_elasticsearch_url; restart_kibana;"
done
}
install_kibana_on_nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment