Monitoring website uptime using Kibana

Anurag Srivastava
Level Up Coding
Published in
4 min readSep 14, 2020

--

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:

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.

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

Learning Kibana 7 made it to the Best New Elasticsearch Books

I’m happy to announce that my book, “Learning Kibana 7: Build powerful Elastic dashboards with Kibana’s data visualization capabilities, 2nd Edition”, made it to BookAuthority’s Best New Elasticsearch Books:
https://bookauthority.org/books/new-elasticsearch-books?t=11vp86&s=award&book=1838550364
BookAuthority collects and ranks the best books in the world, and it is a great honor to get this kind of recognition. Thank you for all your support!
The book is available for purchase on Amazon.

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.

Originally published at https://bqstack.com.

--

--

Author of “Mastering Kibana6.x”, “Kibana7 Quick Start Guide”, “Learning Kibana7”, &“Elasticsearch7 Quick Start Guide” books & AWS Certified Solutions Architect.