We have previously seen how to install Elastic Stack Part I and now we will see how to monitor hardware usage with Metricbeat.
This module will allow us to monitor CPU, memory, Inbound/Outbound traffic and disk utilization with graphical views.
So let's see how to install it on Windows and GNU/Linux systems.
I'll install Metricbeat on every machines I want to monitor in Elasticsearch.
# =================================== Kibana ===================================
# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:
# Kibana Host
# Scheme and port can be left out and will be set to the default (http and 5601)
# In case you specify and additional path, the scheme is required: http://localhost:5601/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
host: "https://X.X.X.X:5601"
ssl.verification_mode: none
username: "elastic"
password: "elastic_password;)"
# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["X.X.X.X:9200"]
# Protocol - either `http` (default) or `https`.
protocol: "https"
ssl.verification_mode: none
# Authentication credentials - either API key or username/password.
#api_key: "id:api_key"
username: "elastic"
password: "elastic_password;)"
PS C:\> cd "C:\Program Files\metricbeat"
PS C:\> .\metricbeat.exe test config -c .\metricbeat.yml
PS C:\> powershell -executionpolicy Unrestricted -file .\install-service-metricbeat.ps1
PS C:\> .\metricbeat.exe setup -e
PS C:\> Start-Service metricbeat
As with memory or the processor, disk performance can be the source of system slowdown. It is therefore an element to be monitored. This is done by measuring I/O (which gives us the read and write rate). In metricbeat's default configuration, the module that enables this measurement is disabled. I'll explain below how to enable the diskio module.
# Module: system
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/8.15/metricbeat-module-system.html
- module: system
period: 10s
metricsets:
- cpu
#- load
- memory
- network
- process
- process_summary
- socket_summary
#- entropy
#- core
- diskio
#- socket
#- service
#- users
PS C:\> Restart-Service metricbeat
root@host:~# apt update && apt-get install apt-transport-https gnupg curl wget
root@host:~# wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
root@host:~# echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | tee /etc/apt/sources.list.d/elastic-8.x.list
root@host:~# apt update && apt-get install metricbeat
# =================================== Kibana ===================================
# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:
# Kibana Host
# Scheme and port can be left out and will be set to the default (http and 5601)
# In case you specify and additional path, the scheme is required: http://localhost:5601/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
host: "https://X.X.X.X:5601"
ssl.verification_mode: none
username: "elastic"
password: "elastic_password;)"
# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["X.X.X.X:9200"]
# Protocol - either `http` (default) or `https`.
protocol: "https"
ssl.verification_mode: none
# Authentication credentials - either API key or username/password.
#api_key: "id:api_key"
username: "elastic"
password: "elastic_password;)"
root@host:~# systemctl start metricbeat
root@host:~# systemctl enable metricbeat
# Module: system
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/main/metricbeat-module-system.html
- module: system
period: 10s
metricsets:
- cpu
- load
- memory
- network
- process
- process_summary
- socket_summary
#- entropy
#- core
- diskio
root@host:~# systemctl restart metricbeat
There are a lot of predefined dashboard for Metricbeat we will see how to use them.
Contact :