search
数据采集 采集源配置 win_perf_counters 采集

win_perf_counters 采集

简介

采集 win_perf_counters 指标上报到 DataFlux 中

前置条件

配置

进入 DataKit 安装目录下的 conf.d/windows 目录,复制 win_perf_counters.conf.sample 并命名为 win_perf_counters.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
  # Whether request a timestamp along with the PerfCounter data or just use current time
  # UsePerfCounterTime=true
  # If UseWildcardsExpansion params is set to true, wildcards (partial wildcards in instance names and wildcards in counters names) in configured counter paths will be expanded
  # and in case of localized Windows, counter paths will be also localized. It also returns instance indexes in instance names.
  # If false, wildcards (not partial) in instance names will still be expanded, but instance indexes will not be returned in instance names.
  #UseWildcardsExpansion = false
  # Period after which counters will be reread from configuration and wildcards in counter paths expanded
  CountersRefreshInterval="1m"

  [[inputs.win_perf_counters.object]]
    # Processor usage, alternative to native, reports on a per core.
    ObjectName = "Processor"
    Instances = ["*"]
    Counters = [
      "% Idle Time",
      "% Interrupt Time",
      "% Privileged Time",
      "% User Time",
      "% Processor Time",
      "% DPC Time",
    ]
    Measurement = "win_cpu"
    # Set to true to include _Total instance when querying for all (*).
    # IncludeTotal=false
    # Print out when the performance counter is missing from object, counter or instance.
    # WarnOnMissing = false

  [[inputs.win_perf_counters.object]]
    # Disk times and queues
    ObjectName = "LogicalDisk"
    Instances = ["*"]
    Counters = [
      "% Idle Time",
      "% Disk Time",
      "% Disk Read Time",
      "% Disk Write Time",
      "% User Time",
      "% Free Space",
      "Current Disk Queue Length",
      "Free Megabytes",
    ]
    Measurement = "win_disk"

  [[inputs.win_perf_counters.object]]
    ObjectName = "PhysicalDisk"
    Instances = ["*"]
    Counters = [
      "Disk Read Bytes/sec",
      "Disk Write Bytes/sec",
      "Current Disk Queue Length",
      "Disk Reads/sec",
      "Disk Writes/sec",
      "% Disk Time",
      "% Disk Read Time",
      "% Disk Write Time",
    ]
    Measurement = "win_diskio"

  [[inputs.win_perf_counters.object]]
    ObjectName = "Network Interface"
    Instances = ["*"]
    Counters = [
      "Bytes Received/sec",
      "Bytes Sent/sec",
      "Packets Received/sec",
      "Packets Sent/sec",
      "Packets Received Discarded",
      "Packets Outbound Discarded",
      "Packets Received Errors",
      "Packets Outbound Errors",
    ]
    Measurement = "win_net"


  [[inputs.win_perf_counters.object]]
    ObjectName = "System"
    Counters = [
      "Context Switches/sec",
      "System Calls/sec",
      "Processor Queue Length",
      "System Up Time",
    ]
    Instances = ["------"]
    Measurement = "win_system"

  [[inputs.win_perf_counters.object]]
    # Example counterPath where the Instance portion must be removed to get data back,
    # such as from the Memory object.
    ObjectName = "Memory"
    Counters = [
      "Available Bytes",
      "Cache Faults/sec",
      "Demand Zero Faults/sec",
      "Page Faults/sec",
      "Pages/sec",
      "Transition Faults/sec",
      "Pool Nonpaged Bytes",
      "Pool Paged Bytes",
      "Standby Cache Reserve Bytes",
      "Standby Cache Normal Priority Bytes",
      "Standby Cache Core Bytes",
    ]
    Instances = ["------"] # Use 6 x - to remove the Instance bit from the counterPath.
    Measurement = "win_mem"

  [[inputs.win_perf_counters.object]]
    # Example query where the Instance portion must be removed to get data back,
    # such as from the Paging File object.
    ObjectName = "Paging File"
    Counters = [
      "% Usage",
    ]
    Instances = ["_Total"]
    Measurement = "win_swap"

配置好后,重启 DataKit 即可生效

采集指标

指标集 win_cpu

tags

名称
instance
objectname

fields

名称 类型
Percent_DPC_Time float
Percent_Idle_Time float
Percent_Interrupt_Time float
Percent_Privileged_Time float
Percent_Processor_Time float
Percent_User_Time float

指标集 win_disk

tags

名称
instance
objectname

fields

名称 类型
Current_Disk_Queue_Length float
Free_Megabytes float
Percent_Disk_Read_Time float
Percent_Disk_Time float
Percent_Disk_Write_Time float
Percent_Free_Space float
Percent_Idle_Time float

指标集 win_diskio

tags

名称
instance
objectname

fields

名称 类型
Current_Disk_Queue_Length float
Disk_Read_Bytes_persec float
Disk_Reads_persec float
Disk_Write_Bytes_persec float
Disk_Writes_persec float
Percent_Disk_Read_Time float
Percent_Disk_Time float
Percent_Disk_Write_Time float

指标集 win_mem

tags

名称
objectname

fields

名称 类型
Available_Bytes float
Cache_Faults_persec float
Demand_Zero_Faults_persec float
Page_Faults_persec float
Pages_persec float
Pool_Nonpaged_Bytes float
Pool_Paged_Bytes float
Standby_Cache_Core_Bytes float
Standby_Cache_Normal_Priority_Bytes float
Standby_Cache_Reserve_Bytes float
Transition_Faults_persec float

指标集 win_net

tags

名称
instance
objectname

fields

名称 类型
Bytes_Received_persec float
Bytes_Sent_persec float
Packets_Outbound_Discarded float
Packets_Outbound_Errors float
Packets_Received_Discarded float
Packets_Received_Errors float
Packets_Received_persec float
Packets_Sent_persec float

指标集 win_swap

tags

名称
instance
objectname

fields

名称 类型
Percent_Usage float

指标集 win_system

tags

名称
objectname

fields

名称 类型
Context_Switches_persec float
Processor_Queue_Length float
System_Calls_persec float
System_Up_Time float