Telegraf: Collect Hyper-V CPU Wait Time per Dispatch (CPU Ready)

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche

More informations about the CPU Wait Time per Dispatch (CPU Ready) here: Hyper-V: Performance (Counters)

To calculate the CPU Wait Time per Dispatch for each VM you need following Telegraf Plugins:

  • Input: win_perf_counters
  • Processor: regex
  • Aggregator: basicstats


Input: win_perf_counters

Collects the data for each virtual processor about CPU Wait Time per Dispatch from Perfmon.

[[inputs.win_perf_counters.object]]
  ObjectName = "Hyper-V Hypervisor Virtual Processor"
  Instances = ["*"]
  Counters = [
    "CPU Wait Time per Dispatch",
  ]
  Measurement = "hyperv_virtual_processor"

Processor: regex

Extract the VM-Name from the Perfmon Counter Instance and create a new Tag "VMName" with it.

[[processors.regex]]
  namepass = ["hyperv_virtual_processor"]
  [[processors.regex.tags]]
    # Extract the VM-Name from the Perfmon Counter Instance and create a new Tag "VMName" with it
    key = "instance"
    pattern = '^(?P<VMName>.+)\:.+$'
    replacement = "${VMName}"
    result_key = "VMName"

Aggregator: basicstats

Calculates the sum of all CPU Wait Time per Dispatch foreach VM.

# Aggregate the sum of the virtual processors wait time per VM.
[[aggregators.basicstats]]
  namepass = ["hyperv_virtual_processor"]
  fieldpass = ["CPU_Wait_Time_per_Dispatch"]
  taginclude = ["VMName", "host"]
  
  ## The period on which to flush & clear the aggregator.
  period = "30s"

  ## If true, the original metric will be dropped by the
  ## aggregator and will not get sent to the output plugins.
  drop_original = true

  ## Configures which basic stats to push as fields
  stats = ["sum"]