telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

[inputs.win_perf_counters] skip "error while getting value for counter" for hyper-v

Open Dominik-esb opened this issue 1 year ago • 5 comments

Relevant telegraf.conf

[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
    ObjectName = "Hyper-V Hypervisor Virtual Processor"
    Instances = ["*"]
    Measurement = "hyperv_processor"
    Counters = [
      "% Guest Run Time",
      "% Hypervisor Run Time",
      "% Idle Time",
      "% Total Run Time"
    ]

Logs from Telegraf

2024-10-28T13:02:30Z E! [inputs.win_perf_counters] Error in plugin: error during collecting data on host "localhost": error while getting value for counter "\\Hyper-V Hypervisor Virtual Processor(*)\\% Guest Run Time": The data item has been added to the query, but has not been validated or accessed. No other status information about this data item is available.
2024-10-28T13:02:45Z E! [inputs.win_perf_counters] Error in plugin: error during collecting data on host "localhost": error while getting value for counter "\\Hyper-V Hypervisor Virtual Processor(*)\\% Guest Run Time": The data item has been added to the query, but has not been validated or accessed. No other status information about this data item is available.

System info

Windows Server 2019 - Hyper-v

Docker

No response

Steps to reproduce

  1. Run a Hyper-v host with vms
  2. Run Telegraf
  3. Remove or stop all VMs
  4. See logs ...

Expected behavior

[inputs.win_perf_counters] to ignore or handle the temporarily missing counter to not break the scraping of metrics.

Actual behavior

When no vm is running on a hyper-v host, the following (and maybe even more) counters are not filled with values/dont exists: ObjectName = "Hyper-V Hypervisor Virtual Processor" - "% Guest Run Time" ObjectName = "Hyper-V Hypervisor Logical Processor" - "% Guest Run Time"

Telegraf then returns the error from the [inputs.win_perf_counters] plugin. With this no other metric is collected anymore.

When turning on a VM the error is fixed and metrics are collected again.

Additional info

No response

Dominik-esb avatar Oct 28 '24 14:10 Dominik-esb

I'm also facing same issue after telegraf upgrade to 1.32.2.

pura1029 avatar Nov 25 '24 06:11 pura1029

Next steps, someone needs to provide a PR with an option to ignore gathering errors.

srebhan avatar Dec 11 '24 13:12 srebhan

All ready started to check if I can provide a fix for this

Dominik-esb avatar Dec 11 '24 14:12 Dominik-esb

Hi any news on this issue we also face?

tmihaldinec avatar Jan 22 '25 17:01 tmihaldinec

Any update on this? Error:

E! [inputs.win_perf_counters] Error in plugin: error during collecting data on host "localhost": error while getting value for counter "\\Hyper-V Dynamic Memory VM(*)\\Current Pressure": The data item has been added to the query, but has not been validated or accessed. No other status information about this data item is available

Is there anyway to let telegraf continue instead of this being a fatal error?

Th3Sh3ll avatar Jan 30 '25 06:01 Th3Sh3ll