Setup Elasticsearch monitoring with Metricbeat and Kibana dashboards

Intermediate 25 min Apr 12, 2026 225 views
Ubuntu 24.04 Debian 12 AlmaLinux 9 Rocky Linux 9

Monitor your Elasticsearch cluster performance with Metricbeat for comprehensive metrics collection and visualization through pre-built Kibana dashboards. This tutorial covers installation, configuration, and automated alerting.

Prerequisites

  • Elasticsearch 8.x cluster running
  • Kibana 8.x installed
  • Admin access to target systems

What this solves

Elasticsearch cluster monitoring is essential for maintaining performance, detecting issues, and ensuring high availability. Metricbeat provides lightweight, efficient monitoring by collecting metrics directly from Elasticsearch nodes and shipping them to your monitoring stack. This approach gives you real-time visibility into cluster health, node performance, index statistics, and query performance without impacting your production workloads.

Step-by-step installation

Update system packages

Start by updating your package manager to ensure you have the latest security patches and package information.

sudo apt update && sudo apt upgrade -y
sudo dnf update -y

Add Elastic repository

Add the official Elastic repository to install Metricbeat 8.15 with all security updates and official support.

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
sudo apt update
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
sudo tee /etc/yum.repos.d/elastic.repo << EOF
[elastic-8.x]
name=Elastic repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

Install Metricbeat 8.15

Install Metricbeat from the official repository to ensure you get the latest features and security patches.

sudo apt install -y metricbeat
sudo dnf install -y metricbeat

Configure Elasticsearch output

Configure Metricbeat to send metrics to your Elasticsearch cluster. Replace the connection details with your actual Elasticsearch endpoints.

sudo cp /etc/metricbeat/metricbeat.yml /etc/metricbeat/metricbeat.yml.backup
metricbeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: true
  reload.period: 10s

output.elasticsearch:
  hosts: ["localhost:9200"]
  username: "elastic"
  password: "your-elastic-password"
  ssl:
    enabled: true
    verification_mode: certificate
    certificate_authorities: ["/etc/elasticsearch/certs/http_ca.crt"]

setup.kibana:
  host: "localhost:5601"
  username: "elastic"
  password: "your-elastic-password"
  ssl:
    enabled: true
    verification_mode: certificate
    certificate_authorities: ["/etc/elasticsearch/certs/http_ca.crt"]

processors:
  - add_host_metadata:
      when.not.contains.tags: forwarded
  - add_docker_metadata: ~
  - add_kubernetes_metadata: ~

logging.level: info
logging.to_files: true
logging.files:
  path: /var/log/metricbeat
  name: metricbeat
  keepfiles: 7
  permissions: 0644

Enable Elasticsearch monitoring module

Enable the Elasticsearch module to collect comprehensive metrics including cluster health, node stats, and index performance.

sudo metricbeat modules enable elasticsearch

Configure Elasticsearch module settings

Configure the Elasticsearch module with your cluster connection details and specify which metrics to collect.

- module: elasticsearch
  metricsets:
    - node
    - node_stats
    - cluster_stats
    - index
    - index_recovery
    - index_summary
    - shard
    - ml_job
  period: 30s
  hosts: ["https://localhost:9200"]
  username: "elastic"
  password: "your-elastic-password"
  ssl:
    enabled: true
    verification_mode: certificate
    certificate_authorities: ["/etc/elasticsearch/certs/http_ca.crt"]
  xpack.enabled: true
  scope: node
  index_recovery.active_only: true

  • module: elasticsearch
metricsets: - ccr - enrich - ilm period: 60s hosts: ["https://localhost:9200"] username: "elastic" password: "your-elastic-password" ssl: enabled: true verification_mode: certificate certificate_authorities: ["/etc/elasticsearch/certs/http_ca.crt"] xpack.enabled: true

Enable system monitoring module

Enable system monitoring to collect host metrics alongside Elasticsearch metrics for comprehensive monitoring.

sudo metricbeat modules enable system
- module: system
  period: 30s
  metricsets:
    - cpu
    - load
    - memory
    - network
    - process
    - process_summary
    - socket_summary
    - filesystem
    - fsstat
  processes: ['.*']
  process.include_top_n:
    by_cpu: 5
    by_memory: 5
  filesystem.ignore_types: []

  • module: system
period: 1m metricsets: - diskio - socket diskio.include_devices: []

Test configuration

Test your Metricbeat configuration to ensure all settings are correct before starting the service.

sudo metricbeat test config
sudo metricbeat test output

Setup Kibana dashboards

Install the pre-built Kibana dashboards and index templates for Elasticsearch monitoring visualization.

sudo metricbeat setup --dashboards
sudo metricbeat setup --index-management

Set correct file permissions

Set appropriate file ownership and permissions for Metricbeat to run securely. The metricbeat user needs read access to configuration files.

Never use chmod 777. It gives every user on the system full access to your files. Instead, fix ownership with chown and use minimal permissions.
sudo chown root:metricbeat /etc/metricbeat/metricbeat.yml
sudo chmod 640 /etc/metricbeat/metricbeat.yml
sudo chown -R root:metricbeat /etc/metricbeat/modules.d/
sudo chmod -R 640 /etc/metricbeat/modules.d/*.yml

Enable and start Metricbeat

Enable Metricbeat to start automatically on boot and start the service to begin collecting metrics.

sudo systemctl enable metricbeat
sudo systemctl start metricbeat
sudo systemctl status metricbeat

Configure Kibana dashboards and visualizations

Access Kibana web interface

Open your web browser and navigate to Kibana to access the monitoring dashboards. Use the elastic user credentials you configured.

https://localhost:5601

Import Elasticsearch monitoring dashboards

Navigate to Stack Management > Kibana > Saved Objects to verify the dashboards were imported correctly. Look for Elasticsearch monitoring dashboards.

Menu > Analytics > Dashboard
Search: "Elasticsearch"

Configure index patterns

Verify that Metricbeat index patterns are created and configured properly for data visualization.

Menu > Stack Management > Kibana > Index Patterns
Verify: "metricbeat-*" pattern exists

Access monitoring dashboards

Navigate to the Elasticsearch monitoring dashboards to view cluster metrics and performance data.

[Metricbeat Elasticsearch] Cluster Overview
[Metricbeat Elasticsearch] Node Overview
[Metricbeat Elasticsearch] Index Overview

Configure alerting and automated monitoring

Create Elasticsearch cluster health rule

Set up alerts for critical cluster health issues using Kibana's alerting framework.

Menu > Stack Management > Rules and Connectors > Rules
Click "Create rule"

Configure the rule with these settings:

Name: "Elasticsearch Cluster Health Alert"
Rule type: "Elasticsearch query"
Index: "metricbeat-*"
Query: "elasticsearch.cluster.status:red"
Threshold: "above 0"
Time window: "1m"

Configure email connector

Set up email notifications for alerts. You can integrate with Slack or Teams following similar patterns as in our Netdata alerts tutorial.

Connector type: Email
SMTP Host: your.smtp.server
Port: 587
Secure: true
User: alerts@example.com
Password: your-smtp-password

Create node performance alerts

Set up alerts for high CPU usage, memory pressure, and disk space issues on Elasticsearch nodes.

Name: "Elasticsearch Node High CPU"
Query: "elasticsearch.node.stats.process.cpu.percent:>90"
Threshold: "above 90"
Time window: "5m"
Actions: Send email notification
Name: "Elasticsearch Node Memory Pressure"
Query: "elasticsearch.node.stats.jvm.mem.heap_used_percent:>85"
Threshold: "above 85"
Time window: "3m"
Actions: Send email notification

Configure index monitoring alerts

Create alerts for index-specific issues like slow queries, indexing failures, and shard allocation problems.

Name: "Elasticsearch Slow Queries"
Query: "elasticsearch.node.stats.indices.search.query_time_in_millis:>5000"
Threshold: "above 5000"
Time window: "2m"
Actions: Send email notification

Verify your setup

Check that Metricbeat is running and collecting metrics from your Elasticsearch cluster.

sudo systemctl status metricbeat
sudo journalctl -u metricbeat -f --lines=20

Verify metrics are being indexed in Elasticsearch:

curl -k -u elastic:your-password 'https://localhost:9200/metricbeat-*/_search?q=metricset.module:elasticsearch&size=5&pretty'

Check Kibana dashboard data:

Navigate to: Dashboard > [Metricbeat Elasticsearch] Cluster Overview
Verify: Metrics are displaying with recent timestamps

Test alerting rules:

Menu > Stack Management > Rules and Connectors > Rules
Check: All rules show "OK" status
Test: Use "Run now" to test alert execution

Common issues

Symptom Cause Fix
Metricbeat won't start Configuration file syntax error Run sudo metricbeat test config to validate syntax
Cannot connect to Elasticsearch Wrong credentials or SSL configuration Verify credentials and SSL certificate paths in config
No data in Kibana dashboards Index pattern not created or wrong time range Check index patterns and adjust time picker to show recent data
Permission denied errors Incorrect file ownership or permissions Run sudo chown -R root:metricbeat /etc/metricbeat and set correct permissions
Alerts not firing Wrong query syntax or threshold values Test queries in Kibana Discover and verify alert conditions
High memory usage Too many metricsets enabled or short collection periods Disable unnecessary metricsets and increase collection intervals

Next steps

Automated install script

Run this to automate the entire setup

Need help?

Don't want to manage this yourself?

We handle managed devops services for businesses that depend on uptime. From initial setup to ongoing operations.