Monitoree su clúster de Elasticsearch autohospedado instalando el OpenTelemetry Collector directamente en servidores o máquinas virtuales. New Relic ofrece opciones de implementación flexibles para adaptarse a la configuración de su infraestructura y a sus requisitos de monitoreo.
You can choose between three collector options:
- NRDOT: Distribución de New Relic de OpenTelemetry
- OTel Collector Contrib: OpenTelemetry Collector estándar con componentes aportados por la comunidad
- Prometheus Receiver: For environments already running a Prometheus Elasticsearch exporter
Opciones de instalación
Seleccione la distribución del recopilador que se ajuste a sus necesidades:
Antes de que empieces
Before configuring Elasticsearch monitoring with NRDOT, ensure you have:
NRDOT collector installed:
You must have NRDOT collector installed and running as a systemd service on your host
If not installed, follow the official NRDOT installation guide to install the collector using the package manager (DEB/RPM) which sets up the systemd service automatically
Privilegios de acceso requeridos:
Tu New Relic
Privilegios de root o sudo en la máquina host
Privilegios de administrador de clúster de Elasticsearch con privilegio de clúster
monitoromanage(consulte la documentación de privilegios de seguridad de Elasticsearch para obtener detalles)Requisitos del sistema:
Versión 7.16 o superior de Elasticsearch - Esta integración requiere un clúster moderno de Elasticsearch
Conectividad de red - HTTPS saliente (puerto 443) al endpoint de ingesta OTLPde New Relic
Valores de configuración listos:
Punto de conexión de Elasticsearch - La URL de su clúster de Elasticsearch (p. ej.,
http://localhost:9200)Nombre del clúster - Un identificador único para su clúster en New Relic
Configurar el monitoreo de Elasticsearch
Once the NRDOT collector is installed, replace the collector's default configuration file with the Elasticsearch monitoring configuration. This will enable Elasticsearch metrics collection. Host metrics and logs are optional and can be added separately.
El archivo de configuración se encuentra en: /etc/nrdot-collector/config.yaml
Sugerencia
Respalde su configuración predeterminada: Antes de modificar el archivo de configuración, cree una copia de seguridad para conservar los ajustes predeterminados:
$sudo cp /etc/nrdot-collector/config.yaml /etc/nrdot-collector/config.yaml.backupPara configurar el colector:
Abra el archivo de configuración con un editor de texto con privilegios de root o sudo:
bash$sudo nano /etc/nrdot-collector/config.yamlElimine todo el contenido existente y reemplácelo con la siguiente configuración para el monitoreo de Elasticsearch:
Importante
Reemplace el valor
endpointcon el endpoint de su clúster de Elasticsearch y actualiceelasticsearch.cluster.nameen el bloque del procesador con un nombre único para identificar su clúster en New Relic.receivers:elasticsearch:endpoint: "http://localhost: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: "<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](Opcional) Para Elasticsearch seguro con autenticación y SSL, modifique la configuración del receptor:
receivers:elasticsearch:endpoint: "https://localhost:9200"username: "your_elasticsearch_username"password: "your_elasticsearch_password"tls:ca_file: "/etc/elasticsearch/certs/http_ca.crt"insecure_skip_verify: falsecollection_interval: 15s(Opcional) Para recopilar métricas del host, agregue el receptor hostmetrics:
receivers:hostmetrics:collection_interval: 60sscrapers:cpu:metrics:system.cpu.utilization: {enabled: true}system.cpu.time: {enabled: true}load:metrics:system.cpu.load_average.1m: {enabled: true}system.cpu.load_average.5m: {enabled: true}system.cpu.load_average.15m: {enabled: true}memory:metrics:system.memory.usage: {enabled: true}system.memory.utilization: {enabled: true}disk:metrics:system.disk.io: {enabled: true}system.disk.operations: {enabled: true}filesystem:metrics:system.filesystem.usage: {enabled: true}system.filesystem.utilization: {enabled: true}network:metrics:system.network.io: {enabled: true}system.network.packets: {enabled: true}process:metrics:process.cpu.utilization:enabled: trueY agregue a los pipelines de servicio:
service:pipelines:metrics/host:receivers: [hostmetrics]processors: [memory_limiter, resourcedetection, batch]exporters: [otlphttp](Optional) To collect Elasticsearch logs, add the filelog receiver. Ensure the user running the collector service (nrdot-collector) has read access to your Elasticsearch log files:
Si ejecuta Elasticsearch en Linux (Host):
receivers:filelog:include:- /var/log/elasticsearch/elasticsearch.log- /var/log/elasticsearch/*.logSi ejecuta Elasticsearch en Docker:
receivers:filelog:include:- /var/lib/docker/containers/*/*.logoperators:- type: movefrom: attributes.logto: bodyY agregue a los pipelines de servicio:
service:pipelines:logs:receivers: [filelog]processors: [resource/cluster_name_override]exporters: [otlphttp](Opcional) Para agregar etiquetas de metadatos personalizadas a sus métricas, utilice el procesador
resource/static_override:processors:resource/static_override:attributes:- key: envvalue: "production"action: upsertservice:pipelines:metrics/elasticsearch:receivers: [elasticsearch]processors: [memory_limiter, resourcedetection, resource/cluster_name_override, resource/static_override, attributes/cardinality_reduction, cumulativetodelta, transform/metadata_nullify, batch]exporters: [otlphttp]Almacene el archivo de configuración.
Configura las variables de entorno:
Crea un directorio de anulación de systemd:
bash$sudo mkdir -p /etc/systemd/system/nrdot-collector.service.dCree el archivo de configuración del entorno:
bash$cat <<EOF | sudo tee /etc/systemd/system/nrdot-collector.service.d/environment.conf$[Service]$Environment="NEWRELIC_OTLP_ENDPOINT=https://otlp.nr-data.net:4318"$Environment="NEWRELIC_LICENSE_KEY=YOUR_LICENSE_KEY_HERE"$Environment="NEW_RELIC_MEMORY_LIMIT_MIB=100"$EOFActualice la configuración con sus valores:
- Reemplace
https://otlp.nr-data.net:4318con el punto final de su región - Reemplace
YOUR_LICENSE_KEY_HEREcon su clave de licencia de New Relic real - Reemplace
100con el límite de memoria deseado en MiB para el colector (predeterminado: 100 MiB). Ajuste según las necesidades de su entorno
- Reemplace
Reinicie el colector NRDOT para aplicar los cambios:
bash$sudo systemctl daemon-reload$sudo systemctl restart nrdot-collector.service
Verificar la recopilación de datos
Verify that the NRDOT collector is running and collecting data without errors:
Verifique el estado del servicio del colector:
bash$sudo systemctl status nrdot-collector.serviceMonitoree los logs del recopilador en busca de errores:
bash$sudo journalctl -u nrdot-collector.service -fBusque conexiones exitosas a Elasticsearch y New Relic. Si ve errores, consulte la guía de solución de problemas.
Antes de que empieces
Antes de configurar el OTel Collector Contrib, asegúrese de tener:
Privilegios de acceso requeridos:
Tu New Relic
Privilegios de root o sudo en la máquina host
Privilegios de administrador de clúster de Elasticsearch con privilegio de clúster
monitoromanage(consulte la documentación de privilegios de seguridad de Elasticsearch para obtener detalles)Requisitos del sistema:
Versión 7.16 o superior de Elasticsearch - Esta integración requiere un clúster moderno de Elasticsearch
Conectividad de red - HTTPS saliente (puerto 443) al endpoint de ingesta OTLPde New Relic
Valores de configuración listos:
Punto de conexión de Elasticsearch - La URL de su clúster de Elasticsearch (p. ej.,
http://localhost:9200)Nombre del clúster - Un identificador único para su clúster en New Relic
Importante
Debe tener OpenTelemetry Collector Contrib instalado en su host antes de continuar. Recomendamos instalar mediante paquetes oficiales (.deb o .rpm) para garantizar que la unidad de servicio systemd se cree correctamente.
Configurar el monitoreo de Elasticsearch
Una vez que OTel Collector Contrib esté instalado, reemplace el archivo de configuración predeterminado del collector con la configuración de monitoreo de Elasticsearch. Esto habilitará la recopilación de métricas de Elasticsearch. Las métricas y los logs del host son opcionales y se pueden agregar por separado.
El archivo de configuración se encuentra en: /etc/otelcol-contrib/config.yaml
Sugerencia
Respalde su configuración predeterminada: Antes de modificar el archivo de configuración, cree una copia de seguridad para conservar los ajustes predeterminados:
$sudo cp /etc/otelcol-contrib/config.yaml /etc/otelcol-contrib/config.yaml.backupPara configurar el colector:
Abra el archivo de configuración con un editor de texto con privilegios de root o sudo:
bash$sudo nano /etc/otelcol-contrib/config.yamlElimine todo el contenido existente y reemplácelo con la siguiente configuración para el monitoreo de Elasticsearch:
Importante
Reemplace el valor
endpointcon el endpoint de su clúster de Elasticsearch y actualiceelasticsearch.cluster.nameen el bloque del procesador con un nombre único para identificar su clúster en New Relic.receivers:elasticsearch:endpoint: "http://localhost: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: {}resource/cluster_name_override:attributes:- key: elasticsearch.cluster.namevalue: "<elasticsearch-cluster-name>"action: upsertresourcedetection:detectors: [ system ]system:resource_attributes:host.name:enabled: truehost.id:enabled: trueos.type:enabled: truebatch:timeout: 10ssend_batch_size: 1024attributes/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}service:pipelines:metrics/elasticsearch:receivers: [elasticsearch]processors: [memory_limiter, resourcedetection, resource/cluster_name_override, attributes/cardinality_reduction, cumulativetodelta, transform/metadata_nullify, batch]exporters: [otlphttp](Opcional) Para Elasticsearch seguro con autenticación y SSL, modifique la configuración del receptor:
receivers:elasticsearch:endpoint: "https://localhost:9200"username: "your_elasticsearch_username"password: "your_elasticsearch_password"tls:ca_file: "/etc/elasticsearch/certs/http_ca.crt"insecure_skip_verify: falsecollection_interval: 15s(Opcional) Para recopilar métricas del host, agregue el receptor hostmetrics:
receivers:hostmetrics:collection_interval: 60sscrapers:cpu:metrics:system.cpu.utilization: {enabled: true}system.cpu.time: {enabled: true}load:metrics:system.cpu.load_average.1m: {enabled: true}system.cpu.load_average.5m: {enabled: true}system.cpu.load_average.15m: {enabled: true}memory:metrics:system.memory.usage: {enabled: true}system.memory.utilization: {enabled: true}disk:metrics:system.disk.io: {enabled: true}system.disk.operations: {enabled: true}filesystem:metrics:system.filesystem.usage: {enabled: true}system.filesystem.utilization: {enabled: true}network:metrics:system.network.io: {enabled: true}system.network.packets: {enabled: true}process:metrics:process.cpu.utilization:enabled: trueY agregue a los pipelines de servicio:
service:pipelines:metrics/host:receivers: [hostmetrics]processors: [memory_limiter, resourcedetection, batch]exporters: [otlphttp](Opcional) Para recopilar logs de Elasticsearch, agregue el receptor filelog. Asegúrese de que el usuario que ejecuta el servicio del recopilador (otelcol-contrib) tenga acceso de lectura a sus archivos de log de Elasticsearch:
Si ejecuta Elasticsearch en Linux (Host):
receivers:filelog:include:- /var/log/elasticsearch/elasticsearch.log- /var/log/elasticsearch/*.logSi ejecuta Elasticsearch en Docker:
receivers:filelog:include:- /var/lib/docker/containers/*/*.logoperators:- type: movefrom: attributes.logto: bodyY agregue a los pipelines de servicio:
service:pipelines:logs:receivers: [filelog]processors: [resource/cluster_name_override]exporters: [otlphttp](Opcional) Para agregar etiquetas de metadatos personalizadas a sus métricas, utilice el procesador
resource/static_override:processors:resource/static_override:attributes:- key: envvalue: "production"action: upsertservice:pipelines:metrics/elasticsearch:receivers: [elasticsearch]processors: [memory_limiter, resourcedetection, resource/cluster_name_override, resource/static_override, attributes/cardinality_reduction, cumulativetodelta, transform/metadata_nullify, batch]exporters: [otlphttp]Almacene el archivo de configuración.
Configura las variables de entorno:
Crea un directorio de anulación de systemd:
bash$sudo mkdir -p /etc/systemd/system/otelcol-contrib.service.dCree el archivo de configuración del entorno:
bash$cat <<EOF | sudo tee /etc/systemd/system/otelcol-contrib.service.d/environment.conf$[Service]$Environment="NEWRELIC_OTLP_ENDPOINT=https://otlp.nr-data.net:4318"$Environment="NEWRELIC_LICENSE_KEY=YOUR_LICENSE_KEY_HERE"$Environment="NEW_RELIC_MEMORY_LIMIT_MIB=100"$EOFActualice la configuración con sus valores:
- Reemplace
https://otlp.nr-data.net:4318con el punto final de su región - Reemplace
YOUR_LICENSE_KEY_HEREcon su clave de licencia de New Relic real - Reemplace
100con el límite de memoria deseado en MiB para el colector (predeterminado: 100 MiB). Ajuste según las necesidades de su entorno
- Reemplace
Reinicie el OTel Collector Contrib para aplicar los cambios:
bash$sudo systemctl daemon-reload$sudo systemctl restart otelcol-contrib.service
Verificar la recopilación de datos
Verifique que el OTel Collector Contrib se esté ejecutando y recopilando datos sin errores:
Verifique el estado del servicio del colector:
bash$sudo systemctl status otelcol-contrib.serviceMonitoree los logs del recopilador en busca de errores:
bash$sudo journalctl -u otelcol-contrib.service -fBusque conexiones exitosas a Elasticsearch y New Relic. Si ve errores, consulte la guía de solución de problemas.
Use this approach if you already have a Prometheus Elasticsearch exporter running in your environment, or if you're migrating from a Prometheus-based monitoring stack.
Sugerencia
Recommended: If you don't already have a Prometheus exporter running, use the NRDOT Collector or OTel Collector Contrib tabs instead. They connect directly to the Elasticsearch API without needing an additional exporter component.
Install and configure the Elasticsearch exporter
The Prometheus Elasticsearch exporter exposes Elasticsearch metrics in Prometheus format on port 9114.
Download the latest release:
bash$wget https://github.com/prometheus-community/elasticsearch_exporter/releases/download/v1.8.0/elasticsearch_exporter-1.8.0.linux-amd64.tar.gz$tar xzf elasticsearch_exporter-*.tar.gz$cd elasticsearch_exporter-*Start the exporter (point it to your Elasticsearch instance):
bash$./elasticsearch_exporter --es.uri=http://localhost:9200Sugerencia
For secured Elasticsearch, use:
--es.uri=https://username:password@localhost:9200 --es.ssl-skip-verifyVerify the exporter is running:
bash$curl http://localhost:9114/metrics | grep elasticsearch_cluster_healthYou should see Prometheus-formatted metrics like
elasticsearch_cluster_health_status,elasticsearch_cluster_health_number_of_nodes, etc.
Configurar el recolector
This configuration works with both NRDOT and OTel Collector Contrib. Place it in the appropriate config location for your collector:
NRDOT:
/etc/nrdot-collector/config.yamlOTel Collector Contrib:
/etc/otelcol-contrib/config.yamlIf you don't have a collector installed yet, follow the installation steps in the NRDOT Collector or OTel Collector Contrib tabs above first, then return here to apply this configuration.
This configuration scrapes metrics from the Elasticsearch exporter and translates them to OpenTelemetry-compatible metric names that power the New Relic Elasticsearch dashboard.
Replace the following values in the configuration:
<elasticsearch-cluster-name>: Your Elasticsearch cluster name for identification in New Relic.localhost:9114: The address of yourelasticsearch_exporterif running on a different host or port.
Set up environment variables
Create a systemd override to inject the required environment variables. Replace <collector-service> with your collector service name (nrdot-collector or otelcol-contrib):
$sudo mkdir -p /etc/systemd/system/<collector-service>.service.dCreate the file /etc/systemd/system/<collector-service>.service.d/environment.conf:
[Service]Environment="NEWRELIC_OTLP_ENDPOINT=https://otlp.nr-data.net:4318"Environment="NEWRELIC_LICENSE_KEY=YOUR_NEWRELIC_LICENSE_KEY"Environment="NEW_RELIC_MEMORY_LIMIT_MIB=100"Reemplace YOUR_NEWRELIC_LICENSE_KEY con su .
Sugerencia
For EU accounts, use NEWRELIC_OTLP_ENDPOINT=https://otlp.eu01.nr-data.net:4318
Iniciar el colector
Replace <collector-service> with your collector service name (nrdot-collector or otelcol-contrib):
$sudo systemctl daemon-reload$sudo systemctl enable <collector-service>$sudo systemctl restart <collector-service>Check the collector status:
$sudo systemctl status <collector-service>$sudo journalctl -u <collector-service> -fVerifique los datos en New Relic
After a few minutes, verify that data is flowing to New Relic:
FROM Metric SELECT count(*)WHERE metricName LIKE 'elasticsearch.%'AND elasticsearch.cluster.name = '<elasticsearch-cluster-name>'SINCE 10 minutes agoSugerencia
Correlacione APM con Elasticsearch: Para conectar su aplicación APM y el clúster de Elasticsearch, incluya el atributo de recurso es.cluster.name="your-cluster-name" en sus métricas de APM. Esto permite la visibilidad entre servicios y una solución de problemas más rápida dentro de New Relic.
Ver sus datos de Elasticsearch
Una vez que el recopilador se esté ejecutando y enviando datos, puede explorar sus métricas de Elasticsearch, crear consultas personalizadas y configurar dashboards de monitoreo en New Relic.
Para obtener información detallada sobre cómo acceder a sus datos, escribir consultas NRQL y configurar alertas, consulte Buscar y consultar datos de Elasticsearch.
Resolución de problemas
Si encuentra problemas durante la instalación o no ve datos en New Relic, consulte nuestra completa guía de solución de problemas para obtener soluciones paso a paso a los problemas comunes.