In the previous tutorial we covered how to successfully integrate one of the most popular, open source, TSDB visualization tools, Grafana with Elasticsearch. In this tutorial we will use Grafana to monitor an Elasticsearch cluster by importing an existing community dashboard along with our additional customizations.
Note: If you already have installed Grafana from the previous tutorial, please move to the Import section.
First, add the following repo to your /etc/apt/sources.list file:
deb https://packagecloud.io/grafana/stable/debian/ jessie main
If you want to try out betas or other release candidates add this repo instead:
deb https://packagecloud.io/grafana/testing/debian/ jessie main
Next, add the Package Cloud key to install the signed packages:
curl https://packagecloud.io/gpg.key | sudo apt-key add -
Update the Apt repositories and install the `grafana` package:
sudo apt-get update && sudo apt-get install grafana
Start the Service (systemd)
sudo systemctl daemon-reload && sudo systemctl start grafana-server && sudo systemctl status grafana-server
Enable the systemd service so Grafana starts at boot.
sudo systemctl enable grafana-server.service
Open your browser-of-choice at http://<host>:3000 and use admin as both the username and password credentials.
Load Elasticsearch Metrics
Download this python script and edit the cluster urls to reflect the ES cluster you wish to monitor (‘ES_METRICS_CLUSTER_URL’) and the ES cluster where the metrics will be stored. (‘ES_METRICS_MONITORING_CLUSTER_URL’).
elasticServer = os.environ.get('ES_METRICS_CLUSTER_URL', 'http://server1:9200') interval = os.environ.get('ES_METRICS_INTERVAL', 60) elasticIndex = os.environ.get('ES_METRICS_INDEX_NAME', 'elasticsearch_metrics') elasticMonitoringCluster = os.environ.get('ES_METRICS_MONITORING_CLUSTER_URL', 'http://server2:9200')
After inputting the correct cluster information, execute the script on the monitoring cluster.
user@host:/~ python elasticsearch2elastic.py Total Elapsed Time: 0.810939073563 Total Elapsed Time: 0.744627952576 Total Elapsed Time: 0.822533130646
Create / Import Dashboard
Back in Grafana, click Home > Import Dashboard. Enter ‘878’ in the ‘Grafana.com Dashboard’ input box, and click Load. Credit goes to Trevor Dodds for providing us with pre-loaded metric configurations to get a jump start for our monitoring.
Adjust and Tune
You can now adjust the time series settings in the top right hand corner to manipulate the data visualizations. Enjoy!
In this tutorial we discussed how to use Grafana to monitor an Elasticsearch cluster by importing an existing community dashboard along with our additional customizations. Comments/Questions? Drop us a line below.
Other Helpful Tutorials
- Getting Started with Elasticsearch on Qbox
- Integrating ElastAlert Email Alerting with Elasticsearch
- Elasticsearch ElastAlert: Alerting at Scale
- Elasticsearch Alerting Now Available on Qbox
- How to Use Elasticsearch, Logstash, and Kibana to Manage NGINX Logs
Give It a Whirl!
It’s easy to spin up a standard hosted Elasticsearch cluster on any of our 47 Rackspace, Softlayer, or Amazon data centers. And you can now provision your own AWS Credits on Qbox Private Hosted Elasticsearch.
Questions? Drop us a note, and we’ll get you a prompt response.
Not yet enjoying the benefits of a hosted ELK-stack enterprise search on Qbox? We invite you to create an account today and discover how easy it is to manage and scale your Elasticsearch environment in our cloud hosting service.