Nous avons précédement vu comment installer Elastic Stack ici et nous allons voir ici comment monitorer l'utilisation des ressources matérielle avec Metricbeat.
Ce module va nous permettre de surveiller la consommation de processeur, mémoire, réseau et utilisation disque depuis des vues graphiques.
Voyons donc comment l'installer sur Windows et GNU/Linux.
Metricbeat doit être installé sur chacune des machines que l'on souhaite monitorer depuis 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
Comme la mémoire ou le processeur, la performance des disques peut être la source des ralentissements su systèùe. C'est donc un élément essentiel à surveiller. Cela se fait par la mesure des I/O (qui donnent le taux de lecture et d'écriture). Dans la configuration par défaut de metricbeat, le module qui permet cette mesure est désactivé. Je vais donc expliquer ci-dessous comment activer le module diskio.
# 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
Il y a pas mal de dashboard prédéfinis pour Metricbeat nous allons voir comment les utiliser.
Contact :