telegraf: Windows Performance Counters input plugin doesn't gather data from multiple instances

Relevant telegraf.conf:

[[inputs.win_perf_counters]]
  ## By default this plugin returns basic CPU and Disk statistics.
  ## See the README file for more examples.
  ## Uncomment examples below or write your own as you see fit. If the system
  ## being polled for data does not have the Object at startup of the Telegraf
  ## agent, it will not be gathered.
  ## Settings:
  # PrintValid = false # Print All matching performance counters
  PreVistaSupport=false
  UseWildcardsExpansion=false

  [[inputs.win_perf_counters.object]]
    ObjectName = "Process"
    #Instances = ["chrome", "chrome#1", "chrome#2"]
    Instances = ["*"]
    Counters = [
      "% Processor Time"
    ]
    Measurement = "win_proc"

System info:

Telegraf 1.7.0 Window 10 64bit

Expected behavior:

> win_proc,host=T480,instance=aesm_service,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=AppleMobileDeviceService,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=ApplicationFrameHost#1,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=ApplicationFrameHost,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=ApsInsSvc,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=audiodg,objectname=Process Percent_Processor_Time=1.547394037246704 1528893106000000000
> win_proc,host=T480,instance=Calculator,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=cmd#1,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=cmd#2,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=cmd,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#1,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#2,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#3,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#4,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#5,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#6,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#7,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost#8,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=conhost,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=csrss#1,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=csrss#2,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=csrss,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=ctfmon#1,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=ctfmon,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=dasHost,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=DbxSvc,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=dllhost#1,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=dllhost#2,objectname=Process Percent_Processor_Time=0 1528893106000000000
> win_proc,host=T480,instance=dllhost,objectname=Process Percent_Processor_Time=0 1528893106000000000

Actual behavior:

> win_proc,host=T480,instance=aesm_service,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=AppleMobileDeviceService,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=ApplicationFrameHost,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=ApsInsSvc,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=audiodg,objectname=Process Percent_Processor_Time=1.5502903461456299 1528892485000000000
> win_proc,host=T480,instance=Calculator,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=cmd,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=conhost,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=csrss,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=ctfmon,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=dasHost,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=DbxSvc,objectname=Process Percent_Processor_Time=0 1528892485000000000
> win_proc,host=T480,instance=dllhost,objectname=Process Percent_Processor_Time=0 1528892485000000000

Additional info:

Problem is that PdhGetFormattedCounterArray returns instance name without an instance index. And in this case values grouping causes that each instance overwrites value of previous.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (14 by maintainers)

Most upvoted comments

@vlastahajek does setting UseWildcardsExpansion work for you?

@glinton, everything seems to be working as expected with attached config in master and in 1.8.2. Both, with UseWildcardsExpansion=true and UseWildcardsExpansion=false.