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

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

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

問題を作成する

OpenTelemetryを使用したセルフホスト型Elasticsearch

OpenTelemetry Collectorサーバーまたは仮想マシンに直接インストールして、セルフホスト型Elasticsearchを監視します。 New Relicインフラストラクチャのセットアップと監視の要件に合わせた柔軟なデプロイメント オプションを提供します。

コレクターの配布方法は2種類から選択できます。

  • NRDOT: OpenTelemetryのNew Relicディストリビューション
  • OTel Collector Contrib:コミュニティ提供のコンポーネントを備えた標準のOpenTelemetry Collector

インストールオプション

ニーズに合ったコレクターの分配方法を選択してください。

重要

Elasticsearch監視に対するNRDOTのサポートは近日中に開始されます。 最新情報をお見逃しなく!

あなたが始める前に

OTel Collector Contrib を設定する前に、以下のものを用意してください。

必要なアクセス権限:

Elasticsearchの監視を設定する

OTel Collector Contribをインストールしたら、コレクターのデフォルト設定ファイルをElasticsearchの監視設定ファイルに置き換えてください。これにより、Elasticsearchのメトリクス収集が可能になります。ホストのメトリクスとログはオプションであり、個別に追加できます。

設定ファイルは以下の場所にあります。 /etc/otelcol-contrib/config.yaml

ヒント

デフォルト設定をバックアップする:設定ファイルを変更する前に、デフォルト設定を保持するためにバックアップコピーを作成してください。

bash
$
sudo cp /etc/otelcol-contrib/config.yaml /etc/otelcol-contrib/config.yaml.backup

コレクターを設定するには:

  1. root権限またはsudo権限を使用して、テキストエディタで設定ファイルを開きます。

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

    重要

    endpoint値を Elasticsearch クラスターのエンドポイントに置き換え、プロセッサブロックのelasticsearch.cluster.name New Relic でクラスターを識別するための一意の名前に更新してください。

    receivers:
    elasticsearch:
    endpoint: "http://localhost: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: "<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]
  3. (オプション)認証とSSLを使用したセキュアなElasticsearchの場合、受信側の設定を変更します。

    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: false
    collection_interval: 15s
  4. (オプション)ホストメトリクスを収集するには、hostmetricsレシーバーを追加します。

    receivers:
    hostmetrics:
    collection_interval: 60s
    scrapers:
    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: true

    さらに、サービスパイプラインに以下を追加します。

    service:
    pipelines:
    metrics/host:
    receivers: [hostmetrics]
    processors: [memory_limiter, resourcedetection, batch]
    exporters: [otlphttp]
  5. (オプション) Elasticsearchのログを収集するには、filelogレシーバーを追加します。コレクターサービス(otelcol-contrib)を実行しているユーザーが、Elasticsearchのログファイルへの読み取りアクセス権を持っていることを確認してください。

    Linux (ホスト) で Elasticsearch を実行している場合:

    receivers:
    filelog:
    include:
    - /var/log/elasticsearch/elasticsearch.log
    - /var/log/elasticsearch/*.log

    Docker で Elasticsearch を実行している場合:

    receivers:
    filelog:
    include:
    - /var/lib/docker/containers/*/*.log
    operators:
    - type: move
    from: attributes.log
    to: body

    さらに、サービスパイプラインに以下を追加します。

    service:
    pipelines:
    logs:
    receivers: [filelog]
    processors: [resource/cluster_name_override]
    exporters: [otlphttp]
  6. (オプション)メトリクスにカスタムメタデータタグを追加するには、 resource/static_overrideプロセッサを使用します。

    processors:
    resource/static_override:
    attributes:
    - key: env
    value: "production"
    action: upsert
    service:
    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]
  7. 設定ファイルを保存します。

  8. 環境変数を設定します。

    systemd オーバーライド ディレクトリを作成します。

    bash
    $
    sudo mkdir -p /etc/systemd/system/otelcol-contrib.service.d

    環境設定ファイルを作成します。

    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"
    $
    EOF

    設定をあなたの値で更新してください。

    • https://otlp.nr-data.net:4318リージョンのエンドポイントに置き換えます
    • YOUR_LICENSE_KEY_HERE実際の New Relic ライセンスキーに置き換えてください。
    • 100コレクターの希望するメモリ制限値(MiB単位)に置き換えてください(デフォルト:100 MiB)。環境のニーズに合わせて調整してください
  9. 変更を適用するには、OTel Collector Contribを再起動してください。

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

データ収集を確認する

OTel Collector Contribが実行され、エラーなくデータを収集していることを確認してください。

  1. コレクターサービスのステータスを確認してください。

    bash
    $
    sudo systemctl status otelcol-contrib.service
  2. エラーがないかコレクター ログを監視します。

    bash
    $
    sudo journalctl -u otelcol-contrib.service -f

    ElasticsearchとNew Relicへの接続が正常に行われていることを確認してください。エラーが表示された場合は、トラブルシューティングガイドを参照してください。

ヒント

APMとElasticsearchを関連付ける: APMアプリケーションとElasticsearchを接続するには、 APMメトリクスにリソース プロパティes.cluster.name="your-cluster-name"を含めます。 これにより、New Relic 内でのサービス間の可視性とトラブルシューティングの高速化が可能になります。

Elasticsearchデータを表示する

コレクターが起動してデータ送信が開始されると、Elasticsearchのメトリクスを調べたり、カスタムクエリを作成したり、New Relicで監視ダッシュボードを設定したりできるようになります。

データへのアクセス、 NRQL書き込みの作成、およびアラートの構成の詳細については、 Elasticsearchデータの検索と書き込み」を参照してください。

トラブルシューティング

インストール中に問題が発生した場合、またはNew Relicにデータが表示されない場合は、一般的な問題に対する段階的な解決策についての包括的なトラブルシューティング ガイドを参照してください。

Copyright © 2026 New Relic株式会社。

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