Elastic Stack Guide Part — 2 (Heartbeat)

Sahil Aggarwal
3 min readOct 13, 2021

In Our previous blog we have seen mainly the filebeat and metric beat and explored the system module of that . In this blog we will see the usage of heart beat and how to monitor the services using heart beat .

Heartbeat should not be installed on each server you monitor , it should be installed on some separate servers from which you can monitor all url’s/services . For example we have one server deployed at x.x.x.x:8000 at some server in aws in north region , then we can install heart beat in our four server in each region(north,south,east,west) of aws and can monitor this server from all the servers to check weather services is UP from all india .

From these four server we can monitors all the services url’s .

For setting up the Heartbeat following is the link :

https://www.elastic.co/guide/en/beats/heartbeat/current/heartbeat-installation-configuration.html

For setting up the dashboard download it from

https://github.com/elastic/uptime-contrib

And upload it to kibana in kibana objects using (import option avaiable in following url of kibana )

http://127.0.0.1:5601/app/management/kibana/objects

After that , On Dashboard tab you can see the MetricBeat monitoring ,

Also you can see the uptime app in kibana to check status and tls expiry time and history of all downtimes :

Followings are some screenshots:

Configuration in heartbeat.yml for setting the name of machine from where url is pinging in heartbeat.yml

processors:
- add_observer_metadata:
# Optional, but recommended geo settings for the location Heartbeat is running in
geo:
# Token describing this location
name: sahil-machine
# Lat, Lon "
#location: "37.926868, -78.024902"

Configuration in hearebeat.yml for setting to monitors urls :

heartbeat.config.monitors:
# Directory + glob pattern to search for configuration files
path: ${path.config}/monitors.d/*.yml
# If enabled, heartbeat will periodically check the config.monitors path for changes
reload.enabled: false
# How often to check for changes
reload.period: 5s
# Configure monitors inline
heartbeat.monitors:
- type: http
# Set enabled to true (or delete the following line) to enable this example monitor
enabled: false
# ID used to uniquely identify this monitor in elasticsearch even if the config changes
id: my-monitor
# Human readable display name for this service in Uptime UI and elsewhere
name: My Monitor
# List or urls to query
urls: ["http://localhost:9200"]
# Configure task schedule
schedule: '@every 10s'
# Total test connection and data exchange timeout
#timeout: 16s
# Name of corresponding APM service, if Elastic APM is in use for the monitored service.
#service.name: my-apm-service-name
- type: http
# Set enabled to true (or delete the following line) to enable this example monitor
enabled: true
# ID used to uniquely identify this monitor in elasticsearch even if the config changes
id: emerge-gurgaon
# Human readable display name for this service in Uptime UI and elsewhere
name: emerge-gurgaon
# List or urls to query
urls: ["https://app.ameyoemerge.in:8887/"]
# Configure task schedule
schedule: '@every 10s'
# Total test connection and data exchange timeout
#timeout: 16s
# Name of corresponding APM service, if Elastic APM is in use for the monitored service.
#service.name: my-apm-service-name
- type: http
# Set enabled to true (or delete the following line) to enable this example monitor
enabled: true
# ID used to uniquely identify this monitor in elasticsearch even if the config changes
id: emerge-banglore-app24
# Human readable display name for this service in Uptime UI and elsewhere
name: emerge-banglore-app24
# List or urls to query
urls: ["https://app24.ameyoemerge.in:8887/"]
# Configure task schedule
schedule: '@every 10s'
# Total test connection and data exchange timeout
#timeout: 16s
# Name of corresponding APM service, if Elastic APM is in use for the monitored service.
#service.name: my-apm-service-name

In the next blog we will explore Logstash with filebeat . Happy debugging . . .

Originally published at http://hello-worlds.in on October 13, 2021.

--

--