Windowsパフォーマンス・カウンターレシーバー

Windows Performance Countersレシーバーを使用すると、Splunk Distribution of OpenTelemetry Collectorで、Windowsレジストリからシステム、アプリケーション、またはカスタムのパフォーマンスカウンターデータを収集できます。

Windows Performance Counters レシーバーを使用すると、Splunk Distribution of OpenTelemetry Collector で、Windows レジストリから設定済みシステム、アプリケーション、またはカスタムのパフォーマンスカウンターデータを収集できます。サポートされているパイプラインのタイプは metrics です。詳細については「パイプラインでデータを処理する」を参照してください。

注: Windowsパフォーマンス・カウンター・レシーバーはWindowsホストでのみ動作します。

Windows Performance Counters レシーバーは、Smart Agent モニター Windows Performance Counters(廃止)を置き換えます。これは Telegraf Windows Performance Counters Input プラグインをベースとし、PDH インターフェイス を使用します。

はじめに

以下の手順に従って、コンポーネントの設定とアクティベーションを行ってください:

  1. Install the Collector for Windows with the installer script」の説明に従って、Splunk Distribution of the OpenTelemetry Collector を Windows ホストプラットフォームにデプロイします。

  2. 次のセクションで説明するように、Windowsパフォーマンス・カウンター・レシーバーを設定します。

  3. Collector を再起動します。

サンプル構成

Windows Performance Counters レシーバーを有効にするには、Collector 構成ファイルの receivers セクションに windowsperfcounters エントリを追加します。例:

receivers:
  windowsperfcounters:
    metrics:
      bytes.committed:
        description: the number of bytes committed to memory
        unit: By
        gauge:
    collection_interval: 30s
    perfcounters:
    - object: Memory
      counters:
        - name: Committed Bytes
          metric: bytes.committed

設定を完了するには、設定ファイルの service セクションの metrics パイプラインに、レシーバーを含めます:

service:
  pipelines:
    metrics:
      receivers:
        - windowsperfcounters

Windows Performance Counters からメトリクスを収集するには、例のように metrics フィールドを使用してメトリクスを定義する必要があります。その後、counters.metric フィールドから定義したメトリクスを参照できます。

利用可能なパフォーマンス・カウンターを見る

利用可能なパフォーマンス・カウンターのリストを見るには、Windows PowerShellまたはWindowsパフォーマンスモニターを使用します。

PowerShell

PowerShellで以下のコマンドを実行し、すべてのパフォーマンス・カウンターセットをリストします:

Get-Counter -ListSet *

各パフォーマンス・カウンターセットのインスタンスを一覧表示するには、以下のコマンドを実行し、<perf_object_name> を検索したいインスタンス名に置き換えます:

Get-Counter -List "<perf_object_name>"
Windows Performance Monitor

以下のコマンドを実行して、Windowsパフォーマンスモニターを開く:

perfmon /sys

Windowsパフォーマンスモニターで、緑のプラス矢印を選択すると、利用可能なパフォーマンス・カウンターのリストが表示されます。

WindowsパフォーマンスモニターのAdd Counters画面には、利用可能なWindowsパフォーマンス・カウンターのリストと、パフォーマンスモニターに追加されたカウンターのリストが表示されます。

次のことに注意してください:

  • 起動時に特定のパフォーマンスカウンタにアクセスできない場合、レシーバーは警告を発し、実行を続行します。

  • OSの設定が異なるため、システムによってはパフォーマンスカウンターが存在しない場合があります。

高度な設定

収集間隔とカウンターを設定する

収集間隔とスクレイピングするパフォーマンスカウンタを設定できます。例:

windowsperfcounters:
  collection_interval: <duration>
  initial_delay: <duration>
  metrics:
    <metric name 1>:
      description: <description>
      unit: <unit type>
      gauge: null
    <metric name 2>:
      description: <description>
      unit: <unit type>
      sum: null
      aggregation: <cumulative or delta>
      monotonic: <true or false>
  perfcounters:
  - object: <object name>
    instances:
      - <instance name>
    counters:
      - name: <counter name>
        metric: <metric name>
        attributes:
        <key>: <value>

異なる収集間隔でスクレイプする

以下の例は、ターゲットによって異なる収集間隔を使用してパフォーマンス・カウンターをスクレイピングする方法を示しています:

receivers:
  windowsperfcounters/memory:
    metrics:
      bytes.committed:
        description: Number of bytes committed to memory
        unit: By
        gauge:
    collection_interval: 30s
    perfcounters:
      - object: Memory
        counters:
          - name: Committed Bytes
            metric: bytes.committed

  windowsperfcounters/processor:
    collection_interval: 1m
    metrics:
      processor.time:
        description: CPU active and idle time
        unit: "%"
        gauge:
    perfcounters:
      - object: "Processor"
        instances: "*"
        counters:
          - name: "% Processor Time"
            metric: processor.time
            attributes:
              state: active
      - object: "Processor"
        instances: ["0", "1"]
        counters:
          - name: "% Idle Time"
            metric: processor.time
            attributes:
              state: idle

  # ...

service:
  pipelines:
    metrics:
      receivers: [windowsperfcounters/memory, windowsperfcounters/processor]

インスタンスを設定する

インスタンスは、パフォーマンスデータを生成する任意のエンティティです。インスタンスは、1 つ以上のカウンタ値を含むことができます。

レシーバーは instances フィールドを通じて以下の値をサポートします:

解釈

未指定

これは、カウンターにインスタンスがない場合にのみ有効な値です。

"*"

_Total を除く、すべてのインスタンス

"_Total"

他のすべてのインスタンスの値を集約した「合計」インスタンス。詳しくは「Total instance behavior and the aggregation counter」を参照してください。

"instance1"

シングルインスタンス

["instance1", "instance2", ...]

インスタンスのセット

["_Total", "instance1", "instance2", ...]

総インスタンスを含むインスタンスのセット

インスタンスの動作と集計カウンターの合計

_Total インスタンスのドロップを避けるには、以下の例のように、レシーバーが独自のメトリックで個別に収集するように設定します:

windowsperfcounters:
  metrics:
    processor.time.total:
      description: Total CPU active and idle time
      unit: "%"
      gauge:
  collection_interval: 30s
  perfcounters:
    - object: "Processor"
      instances:
        - "_Total"
      counters:
        - name: "% Processor Time"
          metric: processor.time.total
警告: instance の値 "*" を使用する場合、カウンターが _Total 以外の値を使用する場合は、レシーバーがメトリクスをスクレイピングした後に集約する際に、ダブルカウントを避けるようにしてください。

すべてのスクレイプでクエリを再作成する

Windows の一部のバージョンでは、カウンタが破損し、最初のスクレイピング後に無効なデータが継続的に返されることがあります。その場合は、カウンタ設定 recreate_querytrue(デフォルトは false)に設定して、レシーバーがすべてのスクレイピングで PDH クエリを再作成するよう指示してください。これは、パフォーマンスに影響する可能性がありますが、collection_interval が非常に高くない限り、問題ありません。

クエリの再作成に失敗した場合、以前のクエリが再利用され、エラーがログに記録されます。

メトリクス形式を定義する

設定されたメトリクスは、レシーバーによってスクレイピングされた1つまたは複数のパフォーマンスカウンターによって使用される、単位とタイプを含むメトリクスの説明で構成されます。

特定の形式でメトリクスを報告するには、メトリクスを定義し、該当する属性とともに、対応するカウンタでそれを参照します。デフォルトでは、メトリクス名はカウンタの名前に対応します。

メトリクスは sum 型または gauge 型です。Sum メトリクスは aggregation および monotonic フィールドをサポートします。

フィールド

説明

デフォルト

name

メトリクスのキーまたは名前。空ではない任意の文字列にできます。

文字列

カウンターの名前

description

メトリクスまたは測定の説明

文字列

unit

測定単位

文字列

1

sum

合計メトリクスの表現

合計設定

gauge

ゲージメトリクスの表現

ゲージ設定

合計メトリクス

以下の設定は、合計メトリクスに適用されます:

フィールド

説明

aggregation

メトリクスの集計の一時性のタイプ

cumulative または delta

monotonic

メトリクス値が減少するかどうか

false

ゲージメトリクス

gauge 設定は設定を受け入れません。前方互換性のためのオブジェクトとして指定されます。

次の例は、Memory/Committed Bytes カウンターを bytes.committed メトリクスとして出力します:

receivers:
  windowsperfcounters:
    metrics:
      bytes.committed:
        description: the number of bytes committed to memory
        unit: By
        gauge:
    collection_interval: 30s
    perfcounters:
    - object: Memory
      counters:
        - name: Committed Bytes
          metric: bytes.committed

service:
  pipelines:
    metrics:
      receivers: [windowsperfcounters]

既知の制限

  • ネットワーク インターフェイスはコンテナ内部では利用できないため、そのシナリオではオブジェクト Network Interface のメトリクスは生成されません。サブプロセスがある場合は、サブプロセスが Network Interface メトリクスをキャプチャします。

  • カウンターのカテゴリ Process は、同じプロセスの複数のインスタンスがあると信頼できません。

    • Windows 11以降では、インスタンス名にプロセスIDが含まれるため、代わりに Process V2 を使用します。

    • Windows 11 より前のバージョンでは、インスタンス名に PID を含めるように Process カウンタカテゴリを設定できます。詳しくは、Microsoft のドキュメント「重複するインスタンス名の処理 」を参照してください。

設定

以下の表は、Windows パフォーマンス・カウンター・レシーバーの構成オプションを示します:

同梱

https://raw.githubusercontent.com/splunk/collector-config-tools/main/cfg-metadata/receiver/windowsperfcounters.yaml

トラブルシューティング

__ ___ ___ _ ______ _____________ _____ ________ ___ ___ ___ ____ __ ___ ____ ____ __ ______ _____________ ______ ___ ___ ___ ____ __ ___ _________ _____

_________ __ ______ _____________ _____ _________

_________ __ ___________ _________ ___ ____ _____ _____

  • ___ _ ________ ___ ___ _______ _______ _________ _______ __ ______ ________

  • ____ ___ ______ ______________ ____ _____ _____ _______ __ ___________ ____ __________ _________ ___ ______ _________ __________ __ _____ ___ ____ _______