
Elasticsearch Exporter is a powerful tool that allows you to scrape and export Elasticsearch metrics to Prometheus. Prometheus is a popular monitoring system that collects metrics from various sources and provides a powerful query language for analyzing data.
You can use Elasticsearch Exporter to send metrics to Prometheus, which can then be visualized in Grafana. Grafana is a flexible and customizable dashboard platform that allows you to create custom panels and charts for your metrics.
Elasticsearch Exporter is designed to be highly customizable, allowing you to tailor the metrics it exports to fit your specific needs. This makes it an ideal choice for organizations with complex monitoring requirements.
Getting Started
To get started with the Elasticsearch Exporter, you'll need to set up and configure it to collect Elasticsearch metrics. This guide will walk you through the process.
The Elasticsearch Exporter can collect metrics like cluster status, active shards, and JVM metrics. It can also expose these metrics as Prometheus-style metrics.
Discover more: Elasticsearch Metrics
You'll need to configure Prometheus to scrape Elasticsearch metrics. This will allow you to visualize your Elasticsearch metrics in Grafana dashboards.
The Elasticsearch Exporter provides features such as shard-level stats and cluster snapshot stats. To learn more about these features, you can check out the Elasticsearch Exporter GitHub repository.
If you're using Grafana Cloud, you can use the Elasticsearch Integration to get up and running quickly. This will automatically provision alerting rules and dashboards for you.
Configuration
The Elasticsearch exporter is a powerful tool for collecting and exposing Elasticsearch metrics in Prometheus format. You can run it using a command line interface, and there are several options available to customize its behavior.
The exporter fetches information from an Elasticsearch cluster on every scrape, which can impose a load on the master nodes if the scrape interval is too short. To avoid this, you can measure how long it takes to fetch /_nodes/stats and /_all/_stats for your ES cluster.
Consider reading: Elasticsearch Cluster Health
You can use the --es.uri flag to specify the address of the Elasticsearch node to connect to. If you're running Elasticsearch on the same machine, you can use http://localhost:9200. You can also use basic auth by specifying the username and password in the URL.
The exporter has several command line options that you can use to customize its behavior. Here are some of the most important ones:
You can also use the --es.timeout flag to specify a timeout for trying to get stats from Elasticsearch. The default timeout is 5 seconds, but you can increase it if you need more time.
It's worth noting that the exporter has several other options that you can use to customize its behavior. You can check the documentation for more information on these options.
A unique perspective: Elasticsearch Use Cases
Elasticsearch Integration
If you're using Grafana Cloud, you can skip all the steps in this guide by installing the Elasticsearch Exporter Integration, which is designed to help you get up and running in a few commands and clicks.
Sign up for free to take advantage of this convenient option.
To set up Elasticsearch Exporter using the Elasticsearch Exporter Integration, check out the Elasticsearch Exporter Integration from the Grafana Cloud docs for a step-by-step guide.
Here's an interesting read: Grafana with Elasticsearch
Metrics and Monitoring
The Elasticsearch Exporter publishes roughly 392 Prometheus time series by default. This is a significant number, but it can be adjusted depending on the exporter's configuration.
To see a list of metrics shipped by default, you can download a sample metrics scrape from the exporter's documentation. This will give you a clear picture of what metrics are being collected and published.
Elasticsearch Exporter may collect and publish far more metrics than the default set, depending on its configuration. This can be managed by toggling the exporter's settings, which can be found in the Elasticsearch Exporter GitHub repository.
One way to reduce metrics usage is to drop time series you don't need to store in Prometheus or Grafana Cloud. This can be achieved through relabeling, which can be learned more about in the Grafana Cloud docs.
You might like: Export Azure Ad Connect Configuration
Prometheus Integration
You can configure a Prometheus scrape job to collect and store Elasticsearch Exporter metrics by adding a scrape job config to the scrape_configs section of your prometheus.yml configuration file.
Replace elasticsearch_exporter_machine_IP_address with the IP address of the machine running Elasticsearch Exporter, which will be localhost if you're running Prometheus on the same machine.
To enable Prometheus to scrape all jobs every 15 seconds, add the following configuration to your prometheus.yml file, which defines a elasticsearch job with a target at elasticsearch_exporter_machine_IP_address:9114.
Save and close the file, then run Prometheus with the file using the following command.
Grafana Cloud's Integration
Grafana Cloud's Integration is a game-changer for those looking to streamline their Prometheus setup.
If you're already using Grafana Cloud, you can skip the entire setup process by installing the Elasticsearch Exporter Integration, which is designed to get you up and running in no time.
This integration is specifically designed to simplify the process of setting up Elasticsearch Exporter, making it a great option for those who want a hassle-free experience.
See what others are reading: Elk Stack Setup
Prometheus Integration
Prometheus Integration is a powerful tool that can help you collect and store metrics from your Elasticsearch Exporter. You can configure a Prometheus scrape job to collect metrics by adding a scrape job config to the scrape_configs section of your prometheus.yml configuration file.
Replace elasticsearch_exporter_machine_IP_address with the IP address of the machine running Elasticsearch Exporter. If you’re running Prometheus on the same machine, this will be localhost. To learn more about configuring Prometheus, please see Configuration from the Prometheus docs.
You can save and close the prometheus.yml file and run Prometheus with the file using the following command. This configuration tells Prometheus to scrape all jobs every 15 seconds. The only configured scrape job is called elasticsearch and defines a elasticsearch_exporter_machine_IP_address:9114 target.
To load alerting rules into Prometheus, add the following to your prometheus.yml configuration file. Be sure to replace elasticsearch_exporter_alerting_rules.yml with the path to your Elasticsearch alerting rules YAML file. This will allow you to define custom alerting rules for your Elasticsearch Exporter.
To load recording rules into Prometheus, add the following to your prometheus.yml configuration file. Be sure to replace elasticsearch_exporter_recording_rules.yml with the path to your Elasticsearch Exporter recording rules YAML file. This will allow you to define custom recording rules for your Elasticsearch Exporter.
The node_exporter needs to be installed to select the nodes that belong to the Elasticsearch cluster. The cluster label can be derived from the platform metadata, for example on GCE. Please refer to the Prometheus SD documentation to see which metadata labels can be used to create the cluster label.
Security and Certificates
Elasticsearch 7.x security privileges are required for the elasticsearch_exporter, and you can pass your username and password directly in the URI or through the ES_USERNAME and ES_PASSWORD environment variables.
To override authentication passed in the URI, specifying those two environment variables is necessary.
The elasticsearch_exporter requires specific security privileges, including clustermonitor, indicesmonitor, and manage_slm. Here's a table outlining the required privileges:
The Zeebe Elasticsearch exporter does not currently support connecting to Elasticsearch using self-signed certificates, but you can create a custom trust store to use with the application.
Elasticsearch 7.x Security Permissions
Elasticsearch 7.x Security Permissions are crucial for secure monitoring and data collection.
In Elasticsearch 7.x, security privileges can be passed directly in the URI or through the ES_USERNAME and ES_PASSWORD environment variables.
Specifying environment variables will override any authentication passed in the URI.
RBACs (Role-Based Access Control) are supported in ES 7.x, which allows for fine-grained access control.
Here are the required security privileges for the elasticsearch_exporter:
Note that the privilege required for es.shards is unclear and may require further investigation.
Self-Signed Certificates

The Zeebe Elasticsearch exporter doesn't currently support connecting to Elasticsearch using self-signed certificates.
If you must use self-signed certificates, you can create a custom trust store to have the application use it. This way, it will also be able to verify certificates signed using trusted root certificate authorities.
To create a custom trust store, you'll need to find the location of the default cacerts trust store, which is usually at $JAVA_HOME/lib/security/cacerts. You can then run the following command to create a new trust store: keytool -importkeystore -srcckeystore $JAVA_HOME/lib/security/cacerts -destkeystore zeebeTrustStore.jks -srcstoretype PKCS12 -deststoretype JKS.
You'll need to set a password for the trust store, but it just needs to be at least 6 characters long.
Here are the steps to create a custom trust store:
- Create a new custom trust store with the same data as the default one, using PKCS12 format.
- Add your custom certificate to the new trust store.
- Update the application to use this trust store.
If you're using containers, you'll need to mount the trust store to the container so it can be found by the java process.
Alerts and Rules
To load alerting rules into Prometheus, add the following to your prometheus.yml configuration file: Be sure to replace elasticsearch_exporter_alerting_rules.yml with the path to your Elasticsearch alerting rules YAML file.
You'll need to install the node_exporter for the example dashboard, and it's a good idea to label your nodes with a cluster label to select the nodes that belong to the Elasticsearch cluster.
The elasticsearch_exporter was maintained by JustWatch before being transferred to the Prometheus Community in May 2021.
The Prometheus SD documentation is a great resource to learn which metadata labels can be used to create the cluster label, depending on your setup.
To load recording rules into Prometheus, add the following to your prometheus.yml configuration file: Be sure to replace elasticsearch_exporter_recording_rules.yml with the path to your Elasticsearch Exporter recording rules YAML file.
Compatibility and Requirements
To use the Elasticsearch Exporter, you'll need to ensure compatibility with certain components. The exporter exports data that can be consumed by components that consume Targets.
The Elasticsearch Exporter is compatible with a range of components, including those that consume Targets. This means you can integrate it with various tools to get the most out of your data.
Check this out: Export Data from Google Analytics 4
To get started, you'll need a machine compatible with the Elasticsearch Exporter release. You can find a list of available releases in the Releases section.
Before installing the Elasticsearch Exporter, make sure you have Elasticsearch running on your machine. The Elasticsearch Installation Guide has more information on how to install and run Elasticsearch.
Prometheus is also a required component, so make sure it's running in your environment or directly on the machine. The Installation from the Prometheus docs will walk you through the installation process.
Grafana is another required component, and it's recommended to have it running in your environment or directly on the machine. The Install Grafana from the Grafana docs has more information on how to install Grafana.
If you want to use Grafana Cloud, you'll need to create a Grafana Cloud account. Grafana Cloud hosts Grafana and a Mimir-based Prometheus metrics endpoint.
A fresh viewpoint: Install Elasticsearch Osx
Introduction
Setting up Elasticsearch Exporter is a straightforward process, and this quickstart will guide you through the necessary steps.
You'll be able to collect Elasticsearch metrics like cluster status, active shards, JVM metrics, and Elasticsearch load, which will be exposed as Prometheus-style metrics.
By following this quickstart, you'll also set up a preconfigured and curated set of recording rules to cache frequent Prometheus queries.
Here's an overview of what you can expect to achieve:
- Set up and configure Elasticsearch Exporter
- Configure Prometheus to scrape Elasticsearch Exporter metrics
- Import Grafana dashboards to visualize your metrics data
- Set up Prometheus alerting rules to alert on your metrics data
This quickstart will have you up and running with Elasticsearch Exporter in no time, and you'll be able to start monitoring your Elasticsearch metrics with ease.
Frequently Asked Questions
How to export data from Elasticsearch into JSON?
To export data from Elasticsearch into JSON, use the elasticsearch-dump tool, which can handle large datasets beyond the 10,000 record limit. Learn more about this tool and its usage at https://github.com/elasticsearch-dump/elasticsearch-dump.
How to export and import Elasticsearch index?
To export an Elasticsearch index, download and configure the Elasticsearch Exporter, then test your settings by exporting a single index. Once configured, you can filter and export your index, with future updates available for continued use.
Featured Images: pexels.com


