<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Elasticsearch Exporter on Grafana Labs</title><link>https://grafana.com/oss/prometheus/exporters/elasticsearch-exporter/</link><description>Recent content in Elasticsearch Exporter on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/oss/prometheus/exporters/elasticsearch-exporter/index.xml" rel="self" type="application/rss+xml"/><item><title>Alerting rules</title><link>https://grafana.com</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://grafana.com</guid><description>&lt;p>This quickstart includes the following alerting rules:&lt;/p>
&lt;ul>
&lt;li>&lt;code>ElasticsearchTooFewNodesRunning&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Less than expected Elasticsearch nodes are running&lt;/p>
&lt;ul>
&lt;li>&lt;code>ElasticsearchHeapTooHigh&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>The heap utilization is too high&lt;/p>
&lt;ul>
&lt;li>&lt;code>ElasticsearchClusterNotHealthy&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Yellow or Red Elasticsearch cluster status&lt;/p>
&lt;ul>
&lt;li>&lt;code>ElasticsearchNodeDiskWatermarkReached&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Disk is running out of available storage&lt;/p>
&lt;ul>
&lt;li>&lt;code>ElasticsearchProcessCPUHigh&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>The Elasticsearch process is using too much CPU&lt;/p>
&lt;ul>
&lt;li>&lt;code>SystemCPUHigh&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>The Elasticsearch node is using too much CPU&lt;/p>
&lt;a class="btn btn--primary br-5 mb-1" href="assets/alerting_rules.yaml" rel="noopener noreferrer">Download the following alerting rules YAML file&lt;/a>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">YAML&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-yaml">groups:
- name: elasticsearch-alerts
rules:
- alert: ElasticsearchTooFewNodesRunning
expr: elasticsearch_cluster_health_number_of_nodes &amp;lt; 3
for: 5m
annotations:
description: &amp;#34;There are only {{ $value }} &amp;lt; 3 ElasticSearch nodes running&amp;#34;
summary: ElasticSearch running on less than 3 nodes
labels:
severity: critical
- alert: ElasticsearchHeapTooHigh
expr: elasticsearch_heap_utilization_percentage &amp;gt; 90
for: 15m
annotations:
description: The heap usage is over 90% for 15m
summary: &amp;#34;ElasticSearch node {{ $labels.name }} heap usage is high&amp;#34;
labels:
severity: critical
- alert: ElasticsearchClusterNotHealthy
expr: elasticsearch_red_cluster_status
for: 2m
annotations:
message: &amp;#34;Cluster {{ $labels.cluster }} health status has been RED for at least 2m. Cluster does not accept writes, shards may be missing or master node hasn&amp;#39;t been elected yet.&amp;#34;
summary: Cluster health status is RED
labels:
severity: critical
- alert: ElasticsearchClusterNotHealthy
expr: elasticsearch_yellow_cluster_status
for: 20m
annotations&amp;#34;:
message&amp;#34;: &amp;#34;Cluster {{ $labels.cluster }} health status has been YELLOW for at least 20m. Some shard replicas are not allocated.&amp;#34;
summary&amp;#34;: Cluster health status is YELLOW
labels:
severity: warning
- alert: ElasticsearchNodeDiskWatermarkReached
expr: elasticsearch_node_disk_watermark_reached &amp;gt; 85
for: 5m
annotations:
message: &amp;#34;Disk Low Watermark Reached at {{ $labels.node }} node in {{ $labels.cluster }} cluster. Shards can not be allocated to this node anymore. You should consider adding more disk to the node.&amp;#34;
summary: &amp;#34;Disk Low Watermark Reached - disk saturation is {{ $value }}%&amp;#34;
labels:
severity: warning
- alert: ElasticsearchNodeDiskWatermarkReached
expr: elasticsearch_node_disk_watermark_reached &amp;gt; 90
for: 5m
annotations:
message: &amp;#34;Disk High Watermark Reached at {{ $labels.node }} node in {{ $labels.cluster }} cluster. Some shards will be re-allocated to different nodes if possible. Make sure more disk space is added to the node or drop old indices allocated to this node.&amp;#34;
summary: &amp;#34;Disk High Watermark Reached - disk saturation is {{ $value }}%&amp;#34;
labels:
severity: critical
- alert: ElasticsearchJVMHeapUseHigh
expr: elasticsearch_heap_utilization_percentage &amp;gt; 75
for: 10m
annotations:
message: &amp;#34;JVM Heap usage on the node {{ $labels.node }} in {{ $labels.cluster }} cluster is {{ $value }}%.&amp;#34;
summary: JVM Heap usage on the node is high
labels:
severity: critical
- alert: SystemCPUHigh
expr: elasticsearch_os_cpu_high &amp;gt; 90
for: 1m
annotations&amp;#34;:
message: &amp;#34;System CPU usage on the node {{ $labels.node }} in {{ $labels.cluster }} cluster is {{ $value }}%&amp;#34;
summary: System CPU usage is high
labels:
severity: critical
- alert: ElasticsearchProcessCPUHigh
expr: elasticsearch_process_cpu_high &amp;gt; 90
for: 1m
annotations:
message: &amp;#34;ES process CPU usage on the node {{ $labels.node }} in {{ $labels.cluster }} cluster is {{ $value }}%&amp;#34;
summary: ES process CPU usage is high
labels:
severity: critical&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>This alerting rule YAML file was generated using the Elasticsearch Exporter &lt;a href="https://github.com/grafana/jsonnet-libs/tree/master/elasticsearch-mixin" target="_blank" rel="noopener noreferrer">mixin&lt;/a>.&lt;/p></description></item><item><title>Cloud integration</title><link>https://grafana.com</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://grafana.com</guid><description>
&lt;div class="bg-solitude p-1 mb-1" style="">
&lt;p>Grafana Cloud comes with an ever-expanding set of integrations to quickly get an observability stack up and running in minutes. The Elasticsearch Integration, built-in to the Grafana Cloud Agent, exposes and scrapes essential Elasticsearch metrics and pushes them to Grafana Cloud. The agent will scrape metrics using an embedded Elasticsearch Exporter, and Grafana Cloud will automatically provision tailored Grafana dashboards and alerts for visualizing and acting on this data.&lt;/p>
&lt;div>
&lt;a class="btn btn--primary br-5 " href="/signup/cloud/connect-account?pg=oss-prom-elasticsearch-exporter-exporter&amp;amp;plcmt=body-txt-overview" rel="noopener noreferrer">Sign up for a free account to get started&lt;/a>
&lt;/div>
&lt;/div>
&lt;p>To learn more, check out the &lt;a href="/docs/grafana-cloud/integrations/">Grafana Cloud docs&lt;/a>.&lt;/p>
&lt;h4 id="how-it-works">How it works&lt;/h4>
&lt;p>Configuring, installing, connecting, and maintaining Prometheus monitoring components typically involves significant domain knowledge. It can take quite a while to go from setup to dashboard and alerts. As the creators of Grafana - and core contributors to Prometheus and Cortex - we build simple integrations to abstract some of this work away in order to quickly get started. How it works:&lt;/p>
&lt;ol>
&lt;li>Sign up (or log in) for a &lt;a href="/signup/cloud/connect-account?pg=oss-prom-elasticsearch-exporter-exporter&amp;amp;plcmt=body-txt-overview">free Grafana Cloud account&lt;/a>.&lt;/li>
&lt;li>Select the target you’d like to observe (an ever-expanding catalogue).&lt;/li>
&lt;li>Run a one-line command to install the Grafana Agent. The agent embeds abnd preconfigures Exporters to expose default metrics, and pushes them to the Grafana Cloud metrics backend.&lt;/li>
&lt;li>Voila! You’ll see tailored Grafana dashboards and will benefit from sane alerting defaults.&lt;/li>
&lt;/ol>
&lt;p>Looking for a different Exporter or integration? Check out our &lt;a href="/docs/grafana-cloud/integrations/">growing library of integrations for popular components&lt;/a> like MySQL, Postgres, Redis, Memcached and more.&lt;/p></description></item><item><title>Dashboards</title><link>https://grafana.com</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://grafana.com</guid><description>&lt;p>&lt;strong>Note: These dashboards may depend on the recording rules in the previous tab. Be sure to import these before importing the dashboards.&lt;/strong>&lt;/p>
&lt;h3 id="elasticsearch-overview-dashboard">&lt;a href="/grafana/dashboards/14191">Elasticsearch Overview Dashboard&lt;/a>&lt;/h3>
&lt;p>&lt;img
class="lazyload d-inline-block"
src="/api/dashboards/14191/images/10185/image"
alt="Elasticsearch Overview Dashboard"/>&lt;/p>
&lt;p>This dashboard includes panels for the following metrics:&lt;/p>
&lt;ul>
&lt;li>Cluster Health&lt;/li>
&lt;li>CPU and Memory&lt;/li>
&lt;li>Disk Usage&lt;/li>
&lt;li>Network Usage&lt;/li>
&lt;li>Load Average&lt;/li>
&lt;li>JVM Memory Usage&lt;/li>
&lt;li>JVM Garbage Collection&lt;/li>
&lt;li>Tripped for Breakers&lt;/li>
&lt;li>Nodes&lt;/li>
&lt;li>Pending Tasks&lt;/li>
&lt;li>Open file descriptors per Cluster&lt;/li>
&lt;li>Active Primary Shards&lt;/li>
&lt;li>Active, Initializing, Relocating and Delayed Shards&lt;/li>
&lt;li>Translog&lt;/li>
&lt;li>Breakers&lt;/li>
&lt;li>Documents total count and size&lt;/li>
&lt;li>Documents count on node&lt;/li>
&lt;li>Documents indexed, deleted and merged rate&lt;/li>
&lt;li>Documents merged bytes&lt;/li>
&lt;li>Query, Indexing and Merging time&lt;/li>
&lt;li>Throttle time for index store&lt;/li>
&lt;li>Total Operations rate, time and stats&lt;/li>
&lt;li>Thread Pool&lt;/li>
&lt;li>Caches&lt;/li>
&lt;li>Segments&lt;/li>
&lt;/ul>
&lt;p>You can import the dashboard directly using the following dashboard ID: &lt;code>14191&lt;/code>&lt;/p>
&lt;p>You can fetch the dashboard JSON &lt;a href="/api/dashboards/14191/revisions/1/download">&lt;strong>here&lt;/strong>&lt;/a>.&lt;/p>
&lt;p>This dashboard was generated using the Elasticsearch Exporter &lt;a href="https://github.com/grafana/jsonnet-libs/tree/master/elasticsearch-mixin" target="_blank" rel="noopener noreferrer">mixin&lt;/a>.&lt;/p></description></item><item><title>Install</title><link>https://grafana.com</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://grafana.com</guid><description>&lt;h2 id="elasticsearch-exporter-quickstart">Elasticsearch Exporter Quickstart&lt;/h2>
&lt;p>In this guide you&amp;rsquo;ll learn how to set up and configure the Elasticsearch Exporter to collect Elasticsearch metrics like cluster status, active shards, JVM metrics, Elasticsearch load, and expose them as Prometheus-style metrics. You&amp;rsquo;ll then configure &lt;a href="https://prometheus.io/" target="_blank" rel="noopener noreferrer">Prometheus&lt;/a> to scrape Elasticsearch metrics and optionally ship them to Grafana Cloud. Finally, you&amp;rsquo;ll set up a preconfigured and curated set of &lt;a href="https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/" target="_blank" rel="noopener noreferrer">recording rules&lt;/a>, Grafana &lt;a href="/grafana/dashboards">dashboards&lt;/a>, and &lt;a href="https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/" target="_blank" rel="noopener noreferrer">alerting rules&lt;/a>. At the end of this guide you&amp;rsquo;ll have dashboards that you can use to visualize your Elasticsearch metrics, and set of preconfigured alerts.&lt;/p>
&lt;p>If you&amp;rsquo;re using &lt;a href="/products/cloud/">Grafana Cloud&lt;/a>, the &lt;a href="/docs/grafana-cloud/integrations/integration-elasticsearch/">Elasticsearch&lt;/a> Integration can help you get up and running quickly. The Elasticsearch Integration embeds the Elasticsearch Exporter into the &lt;a href="https://github.com/grafana/agent" target="_blank" rel="noopener noreferrer">Grafana Cloud Agent&lt;/a> and automatically provisions alerting rules and dashboards, so you don&amp;rsquo;t have to run through the steps in this guide. To learn how to set up Elasticsearch Exporter using the Elasticsearch Integration, please see &lt;a href="/docs/grafana-cloud/integrations/integration-elasticsearch/">Elasticsearch Integration&lt;/a> from the Grafana Cloud docs.&lt;/p>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;p>Before you get started, you should have the following available to you:&lt;/p>
&lt;ul>
&lt;li>A machine compatible with a Elasticsearch Exporter release. To see a list of available releases, please see &lt;a href="https://github.com/justwatchcom/elasticsearch_exporter/releases" target="_blank" rel="noopener noreferrer">Releases&lt;/a>.&lt;/li>
&lt;li>Elasticsearch running on your machine. To learn more about installing and running Elasticsearch, please see the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html" target="_blank" rel="noopener noreferrer">Elasticsearch Installation Guide&lt;/a>.&lt;/li>
&lt;li>Prometheus running in your environment or directly on the machine. To learn how to install Prometheus, please see &lt;a href="https://prometheus.io/docs/prometheus/latest/installation/" target="_blank" rel="noopener noreferrer">Installation&lt;/a> from the Prometheus docs.&lt;/li>
&lt;li>Grafana running in your environment or directly on the machine. To learn how to install Grafana, please see &lt;a href="/docs/grafana/latest/installation/">Install Grafana&lt;/a> from the Grafana docs.&lt;/li>
&lt;li>(Optional) A Grafana Cloud account. Grafana Cloud hosts Grafana and a &lt;a href="/oss/mimir/">Mimir&lt;/a>-based Prometheus metrics endpoint. You will still need to scrape metrics, using either Prometheus installed in your environment, or the &lt;a href="https://github.com/grafana/agent" target="_blank" rel="noopener noreferrer">Grafana Cloud Agent&lt;/a>. To learn more about Grafana Cloud, please see &lt;a href="/products/cloud/">Grafana Cloud&lt;/a>.&lt;/li>
&lt;/ul>
&lt;h2 id="step-1-setting-up-elasticsearch-exporter">Step 1: Setting up Elasticsearch Exporter&lt;/h2>
&lt;p>In this step you&amp;rsquo;ll set up the Elasticsearch exporter on your machine to collect and expose Elasticsearch metrics in Prometheus format. This guide uses an Ubuntu 20.04 system with Elasticsearch 7.12.0. Steps may vary slightly depending on your operating system and Elasticsearch version.&lt;/p>
&lt;p>To begin, log in to your machine and download the relevant Elasticsearch Exporter binary. This guide uses the &lt;code>linux-amd64&lt;/code> binary but you should choose the one corresponding to your system&amp;rsquo;s OS and architecture:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">wget https://github.com/justwatchcom/elasticsearch_exporter/releases/download/v1.1.0/elasticsearch_exporter-1.1.0.linux-amd64.tar.gz&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>Replace &lt;code>v1.1.0&lt;/code> with the version you&amp;rsquo;d like to install. This guide may become stale so it&amp;rsquo;s best to check the Elasticsearch Exporter &lt;a href="https://github.com/justwatchcom/elasticsearch_exporter/releases" target="_blank" rel="noopener noreferrer">Releases&lt;/a> page for the latest stable version.&lt;/p>
&lt;p>Unzip the tarball and &lt;code>cd&lt;/code> into the directory:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">tar xvfz elasticsearch_exporter-1.1.0.linux-amd64.tar.gz
cd elasticsearch_exporter-1.1.0.linux-amd64&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>If you are running Elasticsearch on the same Linux machine, your Elasticsearch endpoint will be &lt;code>http://localhost:9200&lt;/code>. Depending on your setup, this may be different and can be set using the &lt;code>--es.uri&lt;/code> flag.&lt;/p>
&lt;p>Finally, run the exporter:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">./elasticsearch_exporter --es.uri=&amp;#34;http://localhost:9200&amp;#34;
level=info ts=2021-03-31T10:39:42.180223026Z caller=clusterinfo.go:200 msg=&amp;#34;triggering initial cluster info call&amp;#34;
level=info ts=2021-03-31T10:39:42.180423443Z caller=clusterinfo.go:169 msg=&amp;#34;providing consumers with updated cluster info label&amp;#34;
level=info ts=2021-03-31T10:39:42.18398451Z caller=main.go:148 msg=&amp;#34;started cluster info retriever&amp;#34; interval=5m0s
level=info ts=2021-03-31T10:39:42.184156478Z caller=main.go:188 msg=&amp;#34;starting elasticsearch_exporter&amp;#34; addr=:9114&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>If you see the above output, you successfully ran Elasticsearch Exporter.&lt;/p>
&lt;p>Elasticsearch Exporter publishes Elasticsearch metrics in Prometheus format on port 9114. You can test this using &lt;code>curl&lt;/code>. You will need to open a new SSH session or background the Elasticsearch Exporter process to use &lt;code>curl&lt;/code>.&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">curl http://localhost:9114/metrics&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none"># HELP elasticsearch_node_stats_up Was the last scrape of the ElasticSearch nodes endpoint successful.
# TYPE elasticsearch_node_stats_up gauge
elasticsearch_node_stats_up 1
# HELP elasticsearch_nodes_roles Node roles
# TYPE elasticsearch_nodes_roles gauge
elasticsearch_nodes_roles{cluster=&amp;#34;es-docker-cluster&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;,role=&amp;#34;client&amp;#34;} 1
elasticsearch_nodes_roles{cluster=&amp;#34;es-docker-cluster&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;,role=&amp;#34;data&amp;#34;} 1
elasticsearch_nodes_roles{cluster=&amp;#34;es-docker-cluster&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;,role=&amp;#34;ingest&amp;#34;} 1
elasticsearch_nodes_roles{cluster=&amp;#34;es-docker-cluster&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;,role=&amp;#34;master&amp;#34;} 1
# HELP elasticsearch_os_cpu_percent Percent CPU used by OS
# TYPE elasticsearch_os_cpu_percent gauge
elasticsearch_os_cpu_percent{cluster=&amp;#34;es-docker-cluster&amp;#34;,es_client_node=&amp;#34;true&amp;#34;,es_data_node=&amp;#34;true&amp;#34;,es_ingest_node=&amp;#34;true&amp;#34;,es_master_node=&amp;#34;true&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;} 0
# HELP elasticsearch_os_load1 Shortterm load average
# TYPE elasticsearch_os_load1 gauge
elasticsearch_os_load1{cluster=&amp;#34;es-docker-cluster&amp;#34;,es_client_node=&amp;#34;true&amp;#34;,es_data_node=&amp;#34;true&amp;#34;,es_ingest_node=&amp;#34;true&amp;#34;,es_master_node=&amp;#34;true&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;} 0
# HELP elasticsearch_os_load15 Longterm load average
# TYPE elasticsearch_os_load15 gauge
elasticsearch_os_load15{cluster=&amp;#34;es-docker-cluster&amp;#34;,es_client_node=&amp;#34;true&amp;#34;,es_data_node=&amp;#34;true&amp;#34;,es_ingest_node=&amp;#34;true&amp;#34;,es_master_node=&amp;#34;true&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;} 0.05
# HELP elasticsearch_os_load5 Midterm load average
# TYPE elasticsearch_os_load5 gauge
elasticsearch_os_load5{cluster=&amp;#34;es-docker-cluster&amp;#34;,es_client_node=&amp;#34;true&amp;#34;,es_data_node=&amp;#34;true&amp;#34;,es_ingest_node=&amp;#34;true&amp;#34;,es_master_node=&amp;#34;true&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;} 0
# HELP elasticsearch_os_mem_actual_free_bytes Amount of free physical memory in bytes
# TYPE elasticsearch_os_mem_actual_free_bytes gauge
elasticsearch_os_mem_actual_free_bytes{cluster=&amp;#34;es-docker-cluster&amp;#34;,es_client_node=&amp;#34;true&amp;#34;,es_data_node=&amp;#34;true&amp;#34;,es_ingest_node=&amp;#34;true&amp;#34;,es_master_node=&amp;#34;true&amp;#34;,host=&amp;#34;172.29.0.2&amp;#34;,name=&amp;#34;es01&amp;#34;} 0&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>If you see the above output, you&amp;rsquo;re ready to begin scraping Elasticsearch metrics using Prometheus.&lt;/p>
&lt;p>To avoid running and managing Elasticsearch Exporter from the command line, you can create a &lt;code>systemd&lt;/code> service. To learn how to do this, please see &lt;a href="/docs/grafana-cloud/agent/agent_as_service/">Creating a systemd service to manage the agent&lt;/a>. Replace the path to the agent binary with the path to Elasticsearch Exporter.&lt;/p>
&lt;p>The Elasticsearch exporter provide features such as shard-level stats, cluster snapshot stats, etc. To learn more about these features, please see the &lt;a href="https://github.com/justwatchcom/elasticsearch_exporter" target="_blank" rel="noopener noreferrer">Elasticsearch Exporter GitHub repository&lt;/a>.&lt;/p>
&lt;h2 id="step-2-scraping-elasticsearch-exporter-using-prometheus">Step 2: Scraping Elasticsearch Exporter using Prometheus&lt;/h2>
&lt;p>Now that the Elasticsearch Exporter is up and running on your machine, you can configure a Prometheus scrape job to collect and store Elasticsearch Exporter metrics.&lt;/p>
&lt;p>Add the following scrape job config to the &lt;code>scrape_configs&lt;/code> section of your &lt;code>prometheus.yml&lt;/code> configuration file:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">- job_name: elasticsearch
static_configs:
- targets: [&amp;#39;elasticsearch_exporter_machine_IP_address:9114&amp;#39;]&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>Replace &lt;code>elasticsearch_exporter_machine_IP_address&lt;/code> with the IP address of the machine running Elasticsearch Exporter. If you&amp;rsquo;re running Prometheus on the same machine, this will be &lt;code>localhost&lt;/code>. To learn more about configuring Prometheus, please see &lt;a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/" target="_blank" rel="noopener noreferrer">Configuration&lt;/a> from the Prometheus docs.&lt;/p>
&lt;p>If you don&amp;rsquo;t have a &lt;code>prometheus.yml&lt;/code> configuration file, create a simple one using your favorite text editor. Open your preferred text editor and paste in the following Prometheus configuration:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">global:
scrape_interval: 15s
scrape_configs:
- job_name: elasticsearch
static_configs:
- targets: [&amp;#39;elasticsearch_exporter_machine_IP_address:9114&amp;#39;]&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>This configuration tells Prometheus to scrape all jobs every 15 seconds. The only configured scrape job is called &lt;code>elasticsearch&lt;/code> and defines a &lt;code>elasticsearch_exporter_machine_IP_address:9114&lt;/code> target. By default, Prometheus will scrape the &lt;code>/metrics&lt;/code> endpoint using HTTP.&lt;/p>
&lt;p>Save and close the file. You can then run Prometheus with the file using the following command:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">./prometheus --config.file=./prometheus.yml&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;h3 id="shipping-metrics-to-grafana-cloud">Shipping metrics to Grafana Cloud&lt;/h3>
&lt;p>To ship MySQL Exporter metrics to Grafana Cloud from Prometheus, configure the &lt;code>remote_write&lt;/code> parameter in your &lt;code>prometheus.yml&lt;/code> configuration file. To learn more, please see &lt;a href="/docs/grafana-cloud/metrics/prometheus/">Metrics — Prometheus&lt;/a> from the Grafana Cloud docs. To learn more about the &lt;code>remote_write&lt;/code> parameter, please see &lt;a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write" target="_blank" rel="noopener noreferrer">&lt;code>remote_write&lt;/code>&lt;/a> from the Prometheus docs.&lt;/p>
&lt;h2 id="step-3-configure-recording-rules">Step 3: Configure recording rules&lt;/h2>
&lt;p>Using recording rules, you can precompute and cache frequently queried metrics. For example, if a dashboard panel uses a computationally intensive query like a &lt;code>rate()&lt;/code>, you can create a recording rule that runs at a regular reduced interval and saves the result of the intensive query in a new time series. This avoids fetching and computing data every time the dashboard gets refreshed. To learn more about Prometheus recording rules, please see &lt;a href="https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/" target="_blank" rel="noopener noreferrer">Recording Rules&lt;/a> from the Prometheus docs.&lt;/p>
&lt;p>&lt;strong>You should load the following recording rules before loading the dashboards in this guide.&lt;/strong> The dashboard queries and alerting rules use recording rules to reduce load on the Prometheus or Grafana Cloud Metrics servers, depending on where you&amp;rsquo;re evaluating the rules.&lt;/p>
&lt;p>You can fetch the recording rule YAML file &lt;a href="?tab=recording-rules">here&lt;/a>.&lt;/p>
&lt;p>This recording rule YAML file was generated using the Elasticsearch Exporter &lt;a href="https://github.com/grafana/jsonnet-libs/tree/master/elasticsearch-mixin" target="_blank" rel="noopener noreferrer">mixin&lt;/a>.&lt;/p>
&lt;h3 id="load-recording-rules-into-prometheus">Load recording rules into Prometheus&lt;/h3>
&lt;p>To load recording rules into Prometheus, add the following to your &lt;code>prometheus.yml&lt;/code> configuration file:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">rule_files:
- &amp;#34;elasticsearch_exporter_recording_rules.yml&amp;#34;&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>Be sure to replace &lt;code>elasticsearch_exporter_recording_rules.yml&lt;/code> with the path to your Elasticsearch Exporter recording rules YAML file.&lt;/p>
&lt;h3 id="load-recording-rules-into-grafana-cloud">Load recording rules into Grafana Cloud&lt;/h3>
&lt;p>To learn how to load recording rules into Grafana Cloud, please see &lt;a href="/docs/grafana-cloud/alerts/alerts-rules/#prometheus-and-loki-rules-with-cortextool">Prometheus and Loki rules with cortextool&lt;/a>.&lt;/p>
&lt;h2 id="step-4-configuring-dashboards">Step 4: Configuring dashboards&lt;/h2>
&lt;p>This quickstart includes one dashboard:&lt;/p>
&lt;ul>
&lt;li>Elasticsearch Overview&lt;/li>
&lt;/ul>
&lt;p>To learn how to import these dashboards into Grafana, please see &lt;a href="/docs/grafana/latest/dashboards/export-import/#importing-a-dashboard">Importing a dashboard&lt;/a> from the Grafana docs.&lt;/p>
&lt;p>&lt;strong>These dashboard queries may depend on the recording rules defined in the previous step. Be sure to import these before importing the dashboards.&lt;/strong>&lt;/p>
&lt;p>You can fetch the dashboards &lt;a href="?tab=dashboards">here&lt;/a>.&lt;/p>
&lt;h2 id="step-5-configuring-alerts">Step 5: Configuring alerts&lt;/h2>
&lt;p>With Prometheus alerting rules, you can define alerts that fire when PromQL expressions breach some threshold or satisfy specified conditions over a period of time. For example, you can define a &lt;code>HighRequestLatency&lt;/code> alert that fires when a request latency metric is greater than some threshold over a period of time. As soon as the alerting condition is triggered, the alert moves into &lt;code>Pending&lt;/code> state. After satisfying the condition for the period of time defined by the &lt;code>for&lt;/code> parameter, the alert moves into &lt;code>Firing&lt;/code> state. You can configure routing and notifications for firing alerts using a tool like &lt;a href="https://prometheus.io/docs/alerting/latest/alertmanager/" target="_blank" rel="noopener noreferrer">Alertmanager&lt;/a>. Alertmanager is also built-in to Grafana Cloud.&lt;/p>
&lt;p>You can fetch the alerting rule YAML file &lt;a href="?tab=alerting-rules">here&lt;/a>.&lt;/p>
&lt;h3 id="load-alerting-rules-into-prometheus">Load alerting rules into Prometheus&lt;/h3>
&lt;p>To load alerting rules into Prometheus, add the following to your &lt;code>prometheus.yml&lt;/code> configuration file:&lt;/p>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">rule_files:
- &amp;#34;elasticsearch_exporter_alerting_rules.yml&amp;#34;&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>Be sure to replace &lt;code>elasticsearch_exporter_alerting_rules.yml&lt;/code> with the path to your Elasticsearch alerting rules YAML file.&lt;/p>
&lt;h3 id="load-alerting-rules-into-grafana-cloud">Load alerting rules into Grafana Cloud&lt;/h3>
&lt;p>To learn how to load alerting rules into Grafana Cloud, please see &lt;a href="/docs/grafana-cloud/alerts/alerts-rules/#prometheus-and-loki-rules-with-cortextool">Prometheus and Loki rules with cortextool&lt;/a>.&lt;/p>
&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>In this quickstart you installed and ran Elasticsearch Exporter on your Linux machine. You then configured Prometheus to scrape the database and Elasticsearch metrics exposed by Elasticsearch Exporter. You loaded recording rules and alerting rules into Prometheus, and finally imported Grafana dashboards to visualize your Elasticsearch metrics.&lt;/p>
&lt;p>If you&amp;rsquo;re using Grafana Cloud, you can skip all of the steps in this guide by installing the Elasticsearch integration with the Grafana Cloud Agent. This integration embeds a preconfigured Elasticsearch Exporter into the agent and automatically provisions Grafana dashboards and Prometheus alerting and recording rules, so you don&amp;rsquo;t have to import them manually. To learn how to set up the Elasticsearch integration, please see &lt;a href="/docs/grafana-cloud/integrations/">Grafana Cloud Integrations&lt;/a>.&lt;/p>
&lt;p>The dashboards, recording rules, and alerting rules were generated using the Elasticsearch Exporter Mixin. Mixins are reusable templates for dasboards, recording rules, and alerts curated and designed by subject matter experts. To learn more, please see the &lt;a href="https://github.com/grafana/jsonnet-libs/tree/master/elasticsearch-mixin" target="_blank" rel="noopener noreferrer">Elasticsearch Mixin&lt;/a> repository.&lt;/p></description></item><item><title>Recording rules</title><link>https://grafana.com</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://grafana.com</guid><description>&lt;p>&lt;strong>You should load the following recording rules before loading the dashboards in this guide.&lt;/strong> The dashboard queries use recording rules to reduce load on the Prometheus or Grafana Cloud Metrics servers, depending on where you&amp;rsquo;re evaluating the rules.&lt;/p>
&lt;p>This quickstart includes the following recording rules:&lt;/p>
&lt;ul>
&lt;li>&lt;code>elasticsearch_process_cpu_high&lt;/code>&lt;/li>
&lt;li>&lt;code>elasticsearch_os_cpu_high&lt;/code>&lt;/li>
&lt;li>&lt;code>elasticsearch_yellow_cluster_status&lt;/code>&lt;/li>
&lt;li>&lt;code>elasticsearch_red_cluster_status&lt;/code>&lt;/li>
&lt;li>&lt;code>elasticsearch_filesystem_data_used_percent&lt;/code>&lt;/li>
&lt;li>&lt;code>elasticsearch_filesystem_data_free_percent&lt;/code>&lt;/li>
&lt;li>&lt;code>elasticsearch_node_disk_watermark_reached&lt;/code>&lt;/li>
&lt;li>&lt;code>elasticsearch_heap_utilization_percentage&lt;/code>&lt;/li>
&lt;/ul>
&lt;a class="btn btn--primary br-5 mb-1" href="assets/recording_rules.yaml" rel="noopener noreferrer">Download the following recording rules YAML file&lt;/a>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">YAML&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-yaml">groups:
- name: elasticsearch_rules
rules:
- record: elasticsearch_filesystem_data_free_percent
expr: 100 - elasticsearch_filesystem_data_used_percent
- record: elasticsearch_red_cluster_status
expr: sum by (cluster) (elasticsearch_cluster_health_status == 2)
- record: elasticsearch_yellow_cluster_status
expr: sum by (cluster) (elasticsearch_cluster_health_status == 1)
- record: elasticsearch_process_cpu_high
expr: sum by (cluster, instance, name) (elasticsearch_process_cpu_percent)
- record: elasticsearch_os_cpu_high
expr: sum by (cluster, instance, name) (elasticsearch_os_cpu_percent)
- record: elasticsearch_filesystem_data_used_percent
expr: sum by (cluster, instance, name) (
100 * (elasticsearch_filesystem_data_size_bytes - elasticsearch_filesystem_data_free_bytes)
/ elasticsearch_filesystem_data_size_bytes)
- record: elasticsearch_node_disk_watermark_reached
expr: sum by (cluster, instance, name) (round(
(1 - (elasticsearch_filesystem_data_available_bytes / elasticsearch_filesystem_data_size_bytes)
) * 100, 0.001))
- record: elasticsearch_heap_utilization_percentage
expr: sum by (cluster, instance, name) (
100 * (elasticsearch_jvm_memory_used_bytes{area=&amp;#34;heap&amp;#34;} / elasticsearch_jvm_memory_max_bytes{area=&amp;#34;heap&amp;#34;}))&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;p>This recording rule YAML file was generated using the Elasticsearch Exporter &lt;a href="https://github.com/grafana/jsonnet-libs/tree/master/elasticsearch-mixin" target="_blank" rel="noopener noreferrer">mixin&lt;/a>.&lt;/p></description></item></channel></rss>