• /
  • EnglishEspañolFrançais日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

英語版と翻訳版に矛盾がある場合は、英語版が優先されます。詳細については、このページを参照してください。

問題を作成する

セルフホスト型 Elasticsearch への OTel Collector Contrib のインストールと構成

|View as Markdown (English)

LinuxサーバーまたはVM上のセルフホスト型Elasticsearchクラスタをモニターするために、このガイドを使用してOpenTelemetry Collector Contribをインストールおよび設定してください。設定が完了すると、コレクターはElasticsearchクラスタのメトリクスをNew Relicにエクスポートします。ホストのメトリクス、ログ、カスタムタグについては、高度な設定をご覧ください。

互換性と要件

サポート対象

  • Elasticsearch 7.16以降

必要なこと

OTel Collector Contribのインストール

OpenTelemetry Collector Contribをインストールし、systemdサービスとして実行します。公式の.deb/.rpmパッケージにより、サービスユニットが作成されます。

Elasticsearchの監視用にOTel Collector Contribを設定します。

Elasticsearchの監視を有効にするには、コレクターのデフォルト設定を更新してください。

  1. コレクターのデフォルト設定をバックアップしてから、編集用に開いてください:

    bash
    $
    sudo cp /etc/otelcol-contrib/config.yaml /etc/otelcol-contrib/config.yaml.backup
    $
    sudo nano /etc/otelcol-contrib/config.yaml
  2. 既存のすべてのコンテンツを削除し、Elasticsearch監視用の以下の設定に置き換えてください。

    receivers:
    elasticsearch:
    endpoint: "http://<YOUR_ELASTICSEARCH_HOST>:9200"
    collection_interval: 15s
    metrics:
    elasticsearch.os.cpu.usage:
    enabled: true
    elasticsearch.cluster.data_nodes:
    enabled: true
    elasticsearch.cluster.health:
    enabled: true
    elasticsearch.cluster.in_flight_fetch:
    enabled: true
    elasticsearch.cluster.nodes:
    enabled: true
    elasticsearch.cluster.pending_tasks:
    enabled: true
    elasticsearch.cluster.shards:
    enabled: true
    elasticsearch.cluster.state_update.time:
    enabled: true
    elasticsearch.index.documents:
    enabled: true
    elasticsearch.index.operations.merge.current:
    enabled: true
    elasticsearch.index.operations.time:
    enabled: true
    elasticsearch.node.cache.count:
    enabled: true
    elasticsearch.node.cache.evictions:
    enabled: true
    elasticsearch.node.cache.memory.usage:
    enabled: true
    elasticsearch.node.shards.size:
    enabled: true
    elasticsearch.node.cluster.io:
    enabled: true
    elasticsearch.node.documents:
    enabled: true
    elasticsearch.node.disk.io.read:
    enabled: true
    elasticsearch.node.disk.io.write:
    enabled: true
    elasticsearch.node.fs.disk.available:
    enabled: true
    elasticsearch.node.fs.disk.total:
    enabled: true
    elasticsearch.node.http.connections:
    enabled: true
    elasticsearch.node.ingest.documents.current:
    enabled: true
    elasticsearch.node.ingest.operations.failed:
    enabled: true
    elasticsearch.node.open_files:
    enabled: true
    elasticsearch.node.operations.completed:
    enabled: true
    elasticsearch.node.operations.current:
    enabled: true
    elasticsearch.node.operations.get.completed:
    enabled: true
    elasticsearch.node.operations.time:
    enabled: true
    elasticsearch.node.shards.reserved.size:
    enabled: true
    elasticsearch.index.shards.size:
    enabled: true
    elasticsearch.os.cpu.load_avg.1m:
    enabled: true
    elasticsearch.os.cpu.load_avg.5m:
    enabled: true
    elasticsearch.os.cpu.load_avg.15m:
    enabled: true
    elasticsearch.os.memory:
    enabled: true
    jvm.gc.collections.count:
    enabled: true
    jvm.gc.collections.elapsed:
    enabled: true
    jvm.memory.heap.max:
    enabled: true
    jvm.memory.heap.used:
    enabled: true
    jvm.memory.heap.utilization:
    enabled: true
    jvm.threads.count:
    enabled: true
    elasticsearch.index.segments.count:
    enabled: true
    elasticsearch.index.operations.completed:
    enabled: true
    elasticsearch.node.script.cache_evictions:
    enabled: false
    elasticsearch.node.cluster.connections:
    enabled: false
    elasticsearch.node.pipeline.ingest.documents.preprocessed:
    enabled: false
    elasticsearch.node.thread_pool.tasks.queued:
    enabled: false
    elasticsearch.cluster.published_states.full:
    enabled: false
    jvm.memory.pool.max:
    enabled: false
    elasticsearch.node.script.compilation_limit_triggered:
    enabled: false
    elasticsearch.node.shards.data_set.size:
    enabled: false
    elasticsearch.node.pipeline.ingest.documents.current:
    enabled: false
    elasticsearch.cluster.state_update.count:
    enabled: false
    elasticsearch.node.fs.disk.free:
    enabled: false
    jvm.memory.nonheap.used:
    enabled: false
    jvm.memory.pool.used:
    enabled: false
    elasticsearch.node.translog.size:
    enabled: false
    elasticsearch.node.thread_pool.threads:
    enabled: false
    elasticsearch.cluster.state_queue:
    enabled: false
    elasticsearch.node.translog.operations:
    enabled: false
    elasticsearch.memory.indexing_pressure:
    enabled: false
    elasticsearch.node.ingest.documents:
    enabled: false
    jvm.classes.loaded:
    enabled: false
    jvm.memory.heap.committed:
    enabled: false
    elasticsearch.breaker.memory.limit:
    enabled: false
    elasticsearch.indexing_pressure.memory.total.replica_rejections:
    enabled: false
    elasticsearch.breaker.memory.estimated:
    enabled: false
    elasticsearch.cluster.published_states.differences:
    enabled: false
    jvm.memory.nonheap.committed:
    enabled: false
    elasticsearch.node.translog.uncommitted.size:
    enabled: false
    elasticsearch.node.script.compilations:
    enabled: false
    elasticsearch.node.pipeline.ingest.operations.failed:
    enabled: false
    elasticsearch.indexing_pressure.memory.limit:
    enabled: false
    elasticsearch.breaker.tripped:
    enabled: false
    elasticsearch.indexing_pressure.memory.total.primary_rejections:
    enabled: false
    elasticsearch.node.thread_pool.tasks.finished:
    enabled: false
    processors:
    memory_limiter:
    check_interval: 60s
    limit_mib: ${env:NEW_RELIC_MEMORY_LIMIT_MIB:-100}
    cumulativetodelta: {}
    resource/cluster_name_override:
    attributes:
    - key: elasticsearch.cluster.name
    value: "<YOUR_ELASTICSEARCH_CLUSTER_NAME>"
    action: upsert
    resourcedetection:
    detectors: [system]
    system:
    resource_attributes:
    host.name: { enabled: true }
    host.id: { enabled: true }
    os.type: { enabled: true }
    batch:
    timeout: 10s
    send_batch_size: 1024
    attributes/cardinality_reduction:
    actions:
    - key: process.pid
    action: delete
    - key: process.parent_pid
    action: delete
    transform/metadata_nullify:
    metric_statements:
    - context: metric
    statements:
    - 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]

設定パラメーター

以下の表は、上記の設定で使用される主要な設定パラメーターについて説明しています:

パラメータ説明
endpointElasticsearchクラスタのURL。
collection_intervalメトリクスのスクレイプ間隔です。デフォルトは15秒です。
elasticsearch.cluster.name ( resource/cluster_name_override内)New Relicでこのクラスタを識別する一意の名前です。<YOUR_ELASTICSEARCH_CLUSTER_NAME>をアカウント全体で一意の名前に置き換えてください。
NEW_RELIC_MEMORY_LIMIT_MIBご利用の環境に合わせて設定する、コレクターのmemory_limiterプロセッサのメモリ制限(MiB単位)です。
NEWRELIC_LICENSE_KEYあなたのNew Relic ライセンスキー 。
NEWRELIC_OTLP_ENDPOINTNew Relic OTLPエンドポイントに基づく、アカウントのリージョンに対応するNew Relic OTLPエンドポイント。
  1. 設定ファイルを保存します。

オプションで、保護されたクラスタの認証、ホストのメトリクス、ログ収集、またはカスタムメタデータタグを追加できます。高度な設定をご覧ください。

環境変数を設定します。

コレクターがNew Relicにデータを送信するために必要な認証情報と接続の詳細を設定します。

bash
$
sudo mkdir -p /etc/systemd/system/otelcol-contrib.service.d
$
cat <<EOF | sudo tee /etc/systemd/system/otelcol-contrib.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"
$
EOF

OTel Collector Contribを再起動してください。

変更を適用するには、コレクターを再起動してください:

bash
$
sudo systemctl daemon-reload
$
sudo systemctl restart otelcol-contrib.service

データ収集を確認する

コレクターを再起動してから約5分以内に、New Relicでこのクエリを実行して、データが到着していることを確認してください(<YOUR_ELASTICSEARCH_CLUSTER_NAME>をクラスタ名に置き換えます):

FROM Metric SELECT count(*)
WHERE metricName LIKE 'elasticsearch.%'
AND elasticsearch.cluster.name = '<YOUR_ELASTICSEARCH_CLUSTER_NAME>'
SINCE 10 minutes ago

ヒント

コレクター自体を確認することもできます:otelcol-contrib.serviceはactive (running)(sudo systemctl status otelcol-contrib.service)を報告し、ログ(sudo journalctl -u otelcol-contrib.service -f)に接続エラーがないはずです。

約5分以内にデータが表示されない場合は、Elasticsearchのトラブルシューティングをご覧ください。

データを探す、使う

New Relicがデータを収集すると、New Relic UIを通じてElasticsearchの監視にアクセスできるようになります。

New RelicでElasticsearchダッシュボードを見つけるには:

  1. one.newrelic.com > Integrations & Agentsに移動します。
  2. AllタブでDashboardsをクリックし、Elasticsearch (OpenTelemetry Collector)を検索してダッシュボードを表示します。

または、左側のナビゲーションから:

  1. Dashboardsをクリックします。
  2. Elasticsearch (OpenTelemetry Collector)ダッシュボードを検索して表示します。

OTel Collector Contribを使用してElasticsearchの監視をセットアップした後は、次のことが可能です:

ヒント

APMとElasticsearchの関連付け:APMアプリケーションとElasticsearchクラスタを接続するには、APMメトリクスにリソース属性es.cluster.name="your-cluster-name"を含めてください。これにより、New RelicでAPMとElasticsearchのデータを一緒に表示できるようになります。

Copyright © 2026 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.