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

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

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

ノードエクスポーター統合

Linux サーバーのハードウェアとカーネルのメトリックを監視したいですか? これは、 New Relicリモート書き込みインテグレーションと Prometheus Node Exporter を使用して実行できます。 これら 2 つのプログラムを Prometheus 監視システムと組み合わせると、データを New Relic に送信してトラブルシューティングに使用できるようになります。

ここでの手順は、ノード エクスポーターを使用した Linux ホスト メトリクスの監視に関するPrometheus ガイドに基づいています。 その情報の一部を繰り返し、New Relic にデータを送信するための手順を詳しく説明します。

前提条件

始めるために必要なものは次のとおりです:

  • 計画する Linux ホストを決定します。 以下に、EC2、GCP、Azure インスタンス内の Linux サーバーの例を示します。
  • Prometheus 監視システムがインストールされていることを確認してください。 まだダウンロードしていない場合は、 Prometheus サイトからダウンロードできます。

Node Exporterをダウンロードして起動する

次の項目を完了します。

  1. 以下のコマンドを使用して、Node Exporter をダウンロードして起動します。 必ず、 wget URL を Prometheusダウンロードページの最新のものに置き換えてください。

    bash
    $
    # Note that <VERSION>, <OS>, and <ARCH> are placeholders.
    $
    wget https://github.com/prometheus/node_exporter/releases/download/v<VERSION>/node_exporter-<VERSION>.<OS>-<ARCH>.tar.gz
    $
    tar xvfz node_exporter-*.*-amd64.tar.gz
    $
    cd node_exporter-*.*-amd64
    $
    ./node_exporter
  2. キーボード コマンドCONTROL + zbgを使用して、Node Exporter をバックグラウンドで実行するように設定します。 本番環境では、これをサービスとして設定する必要があります (たとえば、 systemdを使用)。

設定

Prometheus を起動する前に、メインのprometheus.yml設定 ファイルにいくつか変更を加える必要があります。 まず、以下の基本的なprometheus.ymlの例から始め、残りのセクションで設定を追加します。 これらの例をコピーして設定ファイルに貼り付けることができます。

job_namenodeに設定されていることに注意してください。

# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: node

PrometheusをNew Relicに接続する

prometheus.ymlに、以下の例のremote_writeスニペットを挿入します。 次の点に留意してください。

  • これは Prometheus v2.26 以降のスニペットです。 古いバージョンを使用している場合は、メインのリモート書き込み手順を参照してください。
  • 必ずYOUR_LICENSE_KEY実際の値に置き換えてください。
  • これを設定ファイルの末尾のglobalセクションと同じインデント レベルに挿入できます。
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: node
remote_write:
- url: https://metric-api.newrelic.com/prometheus/v1/write?prometheus_server=NodeExporter
authorization:
credentials: YOUR_LICENSE_KEY

ターゲットを設定する

static_configs引数を介してターゲットを静的に構成することも、サポートされているサービス検出メカニズムの 1 つを使用して動的検出を使用することもできます。

静的ターゲット

新しいコメント# Target setupの下に静的構成を設定できます。

ダイナミックターゲット

静的ターゲットを構成する代わりに、サービス検出を構成できます。

ホストとAPMの関係を設定する

この Linux サーバーで APM エージェントを使用してアプリケーションを監視する場合は、 New Relicでリレーションシップ機能を有効にするために追加の設定を行う必要があります。 これらの機能は、ホストとアプリの関係に依存します。

関係には、Prometheus ではデフォルトで削除される属性が必要です。 これを回避するには、設定ファイルのrelabel_configsスタンザを通じてそれらを含めることができます。

ヒント

利用可能なすべてのメタ属性は、Prometheus設定ページの適切なsd_configの下で確認できます。

以下の例では、動的検出とラベルの組み合わせを示します。 静的ターゲットを使用している場合は、上記の静的ターゲットを挿入するだけです。

プロメテウスを起動する

これで、Prometheus スクレーパーを起動できます。

  1. 以下を実行します。

    ./prometheus --config.file=./prometheus.yml
  2. キーボード コマンドCONTROL + zbgを使用して、スクレーパーをバックグラウンドで実行するように設定します。 本番環境では、これをサービスとして設定する必要があります (たとえば、 systemdを使用)。

  3. one.newrelic.com> Infrastructure > Hosts に移動して、New Relic UI でデータを確認します。

Copyright © 2024 New Relic株式会社。

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