Operations 7 min read

How to Build a Robust Elasticsearch Monitoring System with Prometheus & Grafana

Learn step‑by‑step how to deploy the Elasticsearch‑exporter via Helm, configure Prometheus to scrape its metrics, and visualize them in Grafana, enabling comprehensive monitoring of Elasticsearch clusters for performance, health, and early issue detection in Kubernetes environments.

Linux Ops Smart Journey
Linux Ops Smart Journey
Linux Ops Smart Journey
How to Build a Robust Elasticsearch Monitoring System with Prometheus & Grafana

In the data‑driven era, Elasticsearch is widely used for log analysis, real‑time monitoring, and site search, but growing data volumes make effective cluster monitoring essential to prevent performance degradation, service interruptions, or data loss.

Elasticsearch monitoring architecture
Elasticsearch monitoring architecture

Deploy Elasticsearch‑exporter

Step 1: Add the Prometheus community Helm chart repository, pull the Elasticsearch‑exporter chart, and push it to a private Harbor registry.

<code># Add chart repository
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts --force-update

# Pull the chart package
helm pull prometheus-community/prometheus-elasticsearch-exporter --version 6.4.0

# Push to private Harbor repository
sudo docker push core.jiaxzeng.com/library/elasticsearch/elasticsearch-exporter:v1.8.0
The push refers to repository [core.jiaxzeng.com/library/elasticsearch/elasticsearch-exporter]
83b2a89f3be6: Pushed
339d7795d6a2: Pushed
134949ec8800: Pushed
v1.8.0: digest: sha256:be27eafadd2edea033383630bd11020b6ea4e46ca47cad447fbdc178503d670e size: 949</code>

Kubernetes host operation

Step 1: Download the chart package directly from the private registry.

<code>sudo helm pull oci://core.jiaxzeng.com/plugins/prometheus-elasticsearch-exporter --version 6.5.0 --untar --untardir /etc/kubernetes/addons/</code>

Step 2: Create a

prometheus-elasticsearch-exporter-values.yaml

file with the exporter configuration.

<code>fullnameOverride: elasticsearch-exporter

image:
  repository: core.jiaxzeng.com/library/elasticsearch/elasticsearch-exporter
  tag: v1.8.0
  pullPolicy: IfNotPresent

log:
  level: info

es:
  uri: https://elastic:[email protected]:9200
  all: true
  indices: true
  indices_settings: true
  indices_mappings: true
  aliases: false
  shards: true
  snapshots: true
  cluster_settings: false
  slm: false
  data_stream: false
  ilm: true
  timeout: 30s
  sslSkipVerify: true</code>

Tip: Save the above configuration to

/etc/kubernetes/addons/prometheus-elasticsearch-exporter-values.yaml

.

Step 3: Install the exporter into the

obs-system

namespace.

<code>helm -n obs-system install elasticsearch-exporter -f prometheus-elasticsearch-exporter-values.yaml prometheus-elasticsearch-exporter
NAME: elasticsearch-exporter
LAST DEPLOYED: Wed Apr 16 11:05:18 2025
NAMESPACE: obs-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
export POD_NAME=$(kubectl get pods --namespace obs-system -l "app.kubernetes.io/name=prometheus-elasticsearch-exporter" -o jsonpath="{.items[0].metadata.name}")

kubectl port-forward $POD_NAME 9108:9108 --namespace obs-system
echo "Visit http://127.0.0.1:9108/metrics to use your application"</code>

Prometheus collects Elasticsearch metrics

Configure Prometheus to scrape the exporter service.

<code>- job_name: 'es-exporter'
  kubernetes_sd_configs:
  - role: service
  relabel_configs:
  - action: keep
    source_labels: [__meta_kubernetes_namespace,__meta_kubernetes_service_name,__meta_kubernetes_service_port_name]
    regex: obs-system;elasticsearch-exporter;http</code>

Verify that Prometheus successfully collects the metrics.

<code>curl -s -u admin $(kubectl -n kube-system get svc prometheus -ojsonpath='{.spec.clusterIP}:{.spec.ports[0].port}')/prometheus/api/v1/query --data-urlencode 'query=up{job=~"es-exporter"}' | jq '.data.result[] | {job: .metric.job, instance: .metric.instance ,status: .value[1]}'
# Expected output example:
{
  "job": "es-exporter",
  "instance": "elasticsearch-exporter.obs-system.svc:9108",
  "status": "1"
}</code>

Add Grafana dashboard for Elasticsearch

Import dashboard ID 14191 (Elasticsearch Exporter Quickstart and Dashboard) into Grafana to visualize the collected metrics.

Grafana dashboard view
Grafana dashboard view
Grafana panel example
Grafana panel example
Grafana monitoring screenshot
Grafana monitoring screenshot

Conclusion

This guide demonstrates how to build a comprehensive Elasticsearch monitoring solution using open‑source tools such as Helm, Prometheus, and Grafana within a Kubernetes environment. By deploying the Elasticsearch‑exporter, configuring Prometheus scrape jobs, and visualizing metrics in Grafana, you can proactively detect and prevent issues, ensuring your Elasticsearch clusters remain stable, performant, and reliable.

monitoringElasticsearchKubernetesPrometheusGrafanaHelmExporter
Linux Ops Smart Journey
Written by

Linux Ops Smart Journey

The operations journey never stops—pursuing excellence endlessly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.