Monitoring website uptime using Kibana


preview imageDevOps
by Anurag Srivastava,Sep 6, 2020, 5:20:33 PM | 4 minutes |

Kibana provides us various features for data visualization and analysis and one of the features that we are going to cover in this blog is Uptime. Using Kibana Uptime, we can monitor the network endpoints using different protocols like HTTP, HTTPS, TCP, etc. I am going to explain a very basic use case to explain Uptime and that is to monitor web-based application uptime. The intent is to get the status in the dashboard if one or more web-based applications are running properly. It also provides us the historical data to understand if the application is performing well.

I am going to use the Kibana Uptime to monitor the bqstack.com website. We can add more than one website for uptime monitoring. But before monitoring the website uptime we need to do some installation and configuration. So please have a look while we are going to set up the stage for the Uptime monitoring. We need to do the following:

We first need to download and install the Heartbeat and here I am doing this configuration on an Ubuntu-based OS. We need to execute the following commands:

curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-7.6.2-amd64.deb
sudo dpkg -i heartbeat-7.6.2-amd64.deb


Now after the installation, we need to modify the /etc/heartbeat/heartbeat.yml file, to set the connection information:

output.elasticsearch:
  hosts: ["<elaticsearch_url>"]
  username: "elastic"
  password: "<password>"
setup.kibana:
  host: "<kibana_url>"

 
In the above Heartbeat configuration file snippet, we need to update the Elasticsearch URL, the password for the elastic user, and Kibana URL.

After adding the Elasticsearch and Kibana details we need to add the monitors for monitoring the URLs. For testing, I am going to monitor the uptime for the index.php file on my localhost. This PHP script is just showing a hello message on the screen, please refer to the following code for index.php:

<?php
echo 'Hello';
?>


We need to edit the following snippet to monitor the index.php file on localhost:

heartbeat.monitors:
- type: http
  urls: ["http://localhost/index.php"]
  schedule: "@every 10s"


After updating these details we need to save the Heartbeat configuration file. After modifying the Heartbeat configuration file, we need to execute the setup command that loads the Kibana index pattern.

sudo heartbeat setup


After executing the setup command, we need to start the Heartbeat service.

sudo service heartbeat-elastic start


We can verify if the Heartbeat service is running by executing the below command:

sudo service heartbeat-elastic status


Now we can open the Uptime screen of Kibana by clicking on the Uptime link from the left menu. It will open the following screen:



In the above uptime overview screen, we can see the uptime details like whether the website/service is up or down, pings over time, monitor status, etc. We can click on the monitor status name to see the details for the uptime monitoring. It not only helps us to monitor the current state of the website/service but also enables us to see the historical data where we can easily find if there are any outages.

This way we can configure different URLs for uptime monitoring. It helps us to keep track of different services or web application uptime. 

Other Blogs on Elastic Stack:

Configure Logstash to push MongoDB data into Elasticsearch
Load CSV Data into Elasticsearch
Introduction to Elasticsearch

Elasticsearch Installation and Configuration on Ubuntu 14.04
Log analysis with Elastic stack 
Elasticsearch Rest API
Basics of Data Search in Elasticsearch
Elasticsearch Rest API
Wildcard and Boolean Search in Elasticsearch
Metrics Aggregation in Elasticsearch
Bucket Aggregation in Elasticsearch
How to create Elasticsearch Cluster

In case of any doubt please leave your comments. You can also follow me on Twitter: https://twitter.com/anu4udilse

If you found this article interesting, then you can explore “Mastering Kibana 6.0”, “Kibana 7 Quick Start Guide”, “Learning Kibana 7”, and “Elasticsearch 7 Quick Start Guide” books to get more insight about Elastic Stack, how to perform data analysis, and how you can create dashboards for key performance indicators using Kibana.



Comments (0)

Leave a comment

Related Blogs

preview thumbnail
Introduction to Logstash

Dec 20, 2019, 11:38:31 AM | Anurag Srivastava

preview thumbnail
Importing MongoDB data into Elasticsearch

Mar 9, 2019, 8:20:38 AM | Anurag Srivastava

preview thumbnail
Importing MySQL data into Elasticsearch

Feb 9, 2019, 12:06:18 PM | Anurag Srivastava

preview thumbnail
Snapshot and Restore Elasticsearch Indices

Sep 16, 2019, 5:55:06 AM | Anurag Srivastava

preview thumbnail
Log analysis with Elastic stack

Jan 31, 2018, 6:11:29 AM | Anurag Srivastava

preview thumbnail
Creating Elasticsearch Cluster

Apr 6, 2019, 8:41:41 PM | Anurag Srivastava

Top Blogs

preview thumbnail
Configure SonarQube Scanner with Jenkins

Jun 21, 2018, 4:58:11 AM | Anurag Srivastava

preview thumbnail
Execute Commands on Remote Machines using sshpass

Jul 16, 2018, 5:00:02 PM | Anurag Srivastava

preview thumbnail
Importing MongoDB data into Elasticsearch

Mar 9, 2019, 8:20:38 AM | Anurag Srivastava

preview thumbnail
Importing MySQL data into Elasticsearch

Feb 9, 2019, 12:06:18 PM | Anurag Srivastava

preview thumbnail
Configure Jenkins for Automated Code Deployment

Jun 13, 2018, 3:44:01 PM | Anurag Srivastava

preview thumbnail
Deploying Angular code using Python script

Jun 26, 2018, 4:50:18 PM | Anurag Srivastava