Use this guide to install and configure NRDOT to monitor a self-hosted Elasticsearch cluster on a Linux server or VM. Once you configure it, the collector exports your Elasticsearch cluster metrics to New Relic. For host metrics, logs, and custom tags, see Advanced configuration.
Compatibility and requirements
Supported
- Elasticsearch 7.16 or later
You need
- A New Relic license key
- Root or sudo privileges on the host
- Elasticsearch cluster admin privileges with
monitorormanagecluster privilege (see Elasticsearch security privileges) - Outbound HTTPS (port 443) connectivity to New Relic's OTLP endpoint
- An Elasticsearch username and password (if your cluster requires authentication)
Install NRDOT collector
Install the NRDOT collector and run it as a systemd service. See Install NRDOT.
Configure the NRDOT collector
Update the collector's default configuration to enable Elasticsearch monitoring.
Back up the collector's default configuration, then open it for editing:
bash$sudo cp /etc/nrdot-collector/config.yaml /etc/nrdot-collector/config.yaml.backup$sudo nano /etc/nrdot-collector/config.yamlDelete all existing content and replace it with the following configuration for Elasticsearch monitoring.
receivers:elasticsearch:endpoint: "http://<YOUR_ELASTICSEARCH_HOST>:9200"collection_interval: 15smetrics:elasticsearch.os.cpu.usage:enabled: trueelasticsearch.cluster.data_nodes:enabled: trueelasticsearch.cluster.health:enabled: trueelasticsearch.cluster.in_flight_fetch:enabled: trueelasticsearch.cluster.nodes:enabled: trueelasticsearch.cluster.pending_tasks:enabled: trueelasticsearch.cluster.shards:enabled: trueelasticsearch.cluster.state_update.time:enabled: trueelasticsearch.index.documents:enabled: trueelasticsearch.index.operations.merge.current:enabled: trueelasticsearch.index.operations.time:enabled: trueelasticsearch.node.cache.count:enabled: trueelasticsearch.node.cache.evictions:enabled: trueelasticsearch.node.cache.memory.usage:enabled: trueelasticsearch.node.shards.size:enabled: trueelasticsearch.node.cluster.io:enabled: trueelasticsearch.node.documents:enabled: trueelasticsearch.node.disk.io.read:enabled: trueelasticsearch.node.disk.io.write:enabled: trueelasticsearch.node.fs.disk.available:enabled: trueelasticsearch.node.fs.disk.total:enabled: trueelasticsearch.node.http.connections:enabled: trueelasticsearch.node.ingest.documents.current:enabled: trueelasticsearch.node.ingest.operations.failed:enabled: trueelasticsearch.node.open_files:enabled: trueelasticsearch.node.operations.completed:enabled: trueelasticsearch.node.operations.current:enabled: trueelasticsearch.node.operations.get.completed:enabled: trueelasticsearch.node.operations.time:enabled: trueelasticsearch.node.shards.reserved.size:enabled: trueelasticsearch.index.shards.size:enabled: trueelasticsearch.os.cpu.load_avg.1m:enabled: trueelasticsearch.os.cpu.load_avg.5m:enabled: trueelasticsearch.os.cpu.load_avg.15m:enabled: trueelasticsearch.os.memory:enabled: truejvm.gc.collections.count:enabled: truejvm.gc.collections.elapsed:enabled: truejvm.memory.heap.max:enabled: truejvm.memory.heap.used:enabled: truejvm.memory.heap.utilization:enabled: truejvm.threads.count:enabled: trueelasticsearch.index.segments.count:enabled: trueelasticsearch.index.operations.completed:enabled: trueelasticsearch.node.script.cache_evictions:enabled: falseelasticsearch.node.cluster.connections:enabled: falseelasticsearch.node.pipeline.ingest.documents.preprocessed:enabled: falseelasticsearch.node.thread_pool.tasks.queued:enabled: falseelasticsearch.cluster.published_states.full:enabled: falsejvm.memory.pool.max:enabled: falseelasticsearch.node.script.compilation_limit_triggered:enabled: falseelasticsearch.node.shards.data_set.size:enabled: falseelasticsearch.node.pipeline.ingest.documents.current:enabled: falseelasticsearch.cluster.state_update.count:enabled: falseelasticsearch.node.fs.disk.free:enabled: falsejvm.memory.nonheap.used:enabled: falsejvm.memory.pool.used:enabled: falseelasticsearch.node.translog.size:enabled: falseelasticsearch.node.thread_pool.threads:enabled: falseelasticsearch.cluster.state_queue:enabled: falseelasticsearch.node.translog.operations:enabled: falseelasticsearch.memory.indexing_pressure:enabled: falseelasticsearch.node.ingest.documents:enabled: falsejvm.classes.loaded:enabled: falsejvm.memory.heap.committed:enabled: falseelasticsearch.breaker.memory.limit:enabled: falseelasticsearch.indexing_pressure.memory.total.replica_rejections:enabled: falseelasticsearch.breaker.memory.estimated:enabled: falseelasticsearch.cluster.published_states.differences:enabled: falsejvm.memory.nonheap.committed:enabled: falseelasticsearch.node.translog.uncommitted.size:enabled: falseelasticsearch.node.script.compilations:enabled: falseelasticsearch.node.pipeline.ingest.operations.failed:enabled: falseelasticsearch.indexing_pressure.memory.limit:enabled: falseelasticsearch.breaker.tripped:enabled: falseelasticsearch.indexing_pressure.memory.total.primary_rejections:enabled: falseelasticsearch.node.thread_pool.tasks.finished:enabled: falseprocessors:memory_limiter:check_interval: 60slimit_mib: ${env:NEW_RELIC_MEMORY_LIMIT_MIB:-100}cumulativetodelta: {}attributes/cluster_state_aggregate:include:match_type: strictmetric_names:- elasticsearch.cluster.state_update.timeactions:- key: typeaction: delete- key: stateaction: deletefilter/critical_operations:metrics:datapoint:# Filters to keep only: query, index, get, merge# Affects only 4 metrics: *.operations.completed and *.operations.time# All other metrics pass through unchanged- 'attributes["operation"] == "query" or attributes["operation"] == "index" or attributes["operation"] == "get" or attributes["operation"] == "merge" or attributes["operation"] == nil'resource/cluster_name_override:attributes:- key: elasticsearch.cluster.namevalue: "<YOUR_ELASTICSEARCH_CLUSTER_NAME>"action: upsertresourcedetection:detectors: [ system ]system:resource_attributes:host.name:enabled: truehost.id:enabled: trueos.type:enabled: truebatch:timeout: 30ssend_batch_size: 2048send_batch_max_size: 4096attributes/cardinality_reduction:actions:- key: process.pidaction: delete- key: process.parent_pidaction: deletetransform/metadata_nullify:metric_statements:- context: metricstatements:- set(description, "")- set(unit, "")exporters:otlphttp:endpoint: ${env:NEWRELIC_OTLP_ENDPOINT}headers:api-key: ${env:NEWRELIC_LICENSE_KEY}compression: gziptimeout: 30sretry_on_failure:enabled: trueinitial_interval: 5smax_interval: 30smax_elapsed_time: 300sservice:pipelines:metrics/elasticsearch:receivers: [elasticsearch]processors: [memory_limiter, resourcedetection, resource/cluster_name_override, attributes/cardinality_reduction, filter/critical_operations, attributes/cluster_state_aggregate, cumulativetodelta, transform/metadata_nullify, batch]exporters: [otlphttp]
Configuration parameters
The following table describes the key configuration parameters used in the configuration above:
| Parameter | Description |
|---|---|
endpoint | Your Elasticsearch cluster's URL. |
collection_interval | The interval between metric scrapes. The default is 15s. |
elasticsearch.cluster.name | A unique name identifying this cluster in New Relic. |
NEW_RELIC_MEMORY_LIMIT_MIB | The memory limit, in MiB, for the collector's memory_limiter processor, set to fit your environment. |
NEWRELIC_LICENSE_KEY | Your New Relic license key. |
NEWRELIC_OTLP_ENDPOINT | The New Relic OTLP endpoint for your account's region, per New Relic OTLP endpoints. |
- Save the configuration file.
You can optionally add secured-cluster authentication, host metrics, log collection, or custom metadata tags. See Advanced configuration.
Set the environment variables
Set the credentials and connection details the collector needs to send data to New Relic.
$sudo mkdir -p /etc/systemd/system/nrdot-collector.service.d$cat <<EOF | sudo tee /etc/systemd/system/nrdot-collector.service.d/environment.conf$[Service]$Environment="NEWRELIC_OTLP_ENDPOINT=<YOUR_NEWRELIC_OTLP_ENDPOINT>"$Environment="NEWRELIC_LICENSE_KEY=<YOUR_NEWRELIC_LICENSE_KEY>"$Environment="NEW_RELIC_MEMORY_LIMIT_MIB=100"$EOFRestart the NRDOT collector
Restart the collector to apply your changes:
$sudo systemctl daemon-reload$sudo systemctl restart nrdot-collector.serviceVerify data collection
Within ~5 minutes of restarting the collector, run this query in New Relic to confirm data is flowing (replace <YOUR_ELASTICSEARCH_CLUSTER_NAME> with your cluster's name):
FROM Metric SELECT count(*)WHERE metricName LIKE 'elasticsearch.%'AND elasticsearch.cluster.name = '<YOUR_ELASTICSEARCH_CLUSTER_NAME>'SINCE 10 minutes agoヒント
You can also check the collector itself: nrdot-collector.service should report active (running) (sudo systemctl status nrdot-collector.service), with no connection errors in the logs (sudo journalctl -u nrdot-collector.service -f).
If you don't see data within ~5 minutes, see Elasticsearch troubleshooting.
Find and use your data
Once New Relic collects your data, you can access Elasticsearch monitoring through the New Relic UI.
To find your Elasticsearch dashboard in New Relic:
- Go to one.newrelic.com > Integrations & Agents.
- Under the All tab, click Dashboards, then search for Elasticsearch (OpenTelemetry Collector) to view the dashboard.
Or, from the left navigation:
- Click Dashboards.
- Search for the Elasticsearch (OpenTelemetry Collector) dashboard to view it.
After setting up Elasticsearch monitoring with NRDOT, you can:
- Create custom dashboards to visualize your Elasticsearch metrics
- Set up alerts for critical cluster health and performance thresholds
- Explore your data using New Relic query capabilities
ヒント
Correlate APM with Elasticsearch: To connect your APM application and Elasticsearch cluster, include the resource attribute es.cluster.name="your-cluster-name" in your APM metrics. This lets you view APM and Elasticsearch data together in New Relic.