Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.

Windows Performance Counter plugin

budaqing edited this page Feb 2, 2016 · 12 revisions

Windows Performance Counter plugin

Microsoft Windows provides a very good metric framework. It provides access to it's metric values via the PerformanceCounter component under the System.Diagnostics namespace. This plugin use the Windows PerformanceCounter component to collect the configured metrics. Collected metric values can be scaled up or down, for example if the Windows metric vlaue is in bytes, it can be converted to kilo-bytes by setting the scale down factor to 1024.

app.config comes with a few standard performance counters(eg: cpu, memory, swap, file I/O, disk), for a complete list of metric values, refer to the Windows Performance Counters

Collectd (Unix version) has some meta data (plugin name, plugin instance, type, type instance) for each metric. Each performance counter can be mapped to it's Collectd equivalent meta data via configuration.

Configuration

<WindowsPerformanceCounter>
  <RefreshInstancesConfiguration Enable="true" Interval="900"/>
  <Counters>
    <Counter Category="Processor" Name="% Processor Time" Instance="_Total" CollectdPlugin="cpu" CollectdPluginInstance="" CollectdType="percent" CollectdTypeInstance="processor"/>
    <Counter Category="Processor" Name="% Idle Time" Instance="_Total" CollectdPlugin="cpu" CollectdPluginInstance="" CollectdType="percent" CollectdTypeInstance="idle"/>
    <Counter Category="Processor" Name="% Privileged Time" Instance="_Total" CollectdPlugin="cpu" CollectdPluginInstance="" CollectdType="percent" CollectdTypeInstance="system"/>
    <Counter Category="Processor" Name="% User Time" Instance="_Total" CollectdPlugin="cpu" CollectdPluginInstance="" CollectdType="percent" CollectdTypeInstance="user"/>
    <Counter Category="Processor" Name="% Interrupt Time" Instance="_Total" CollectdPlugin="cpu" CollectdPluginInstance="" CollectdType="percent" CollectdTypeInstance="interrupt"/>
    <Counter Category="Memory" Name="Available Bytes" CollectdPlugin="memory" CollectdPluginInstance="" CollectdType="memory" CollectdTypeInstance="free"/>
    <Counter Transformer="MemoryAvailableBytesToUsedPercentage" Category="Memory" Name="Available Bytes" CollectdPlugin="memory" CollectdPluginInstance="" CollectdType="percent" CollectdTypeInstance="used"/>
    <Counter Category="Memory" Name="Page Faults/sec" CollectdPlugin="memory" CollectdPluginInstance="" CollectdType="memory" CollectdTypeInstance="faults_per_sec"/>
    <Counter Category="Memory" Name="% Committed Bytes In Use" CollectdPlugin="memory" CollectdPluginInstance="" CollectdType="memory" CollectdTypeInstance="percent_committed_inuse"/>
    <Counter Category="Paging File" Name="% Usage" Instance="_Total" CollectdPlugin="swap" CollectdPluginInstance="" CollectdType="percent" CollectdTypeInstance="percent_used"/>
    <Counter Transformer="Averages" TransformerParameters="60,300,900" Category="System" Name="Processor Queue Length" CollectdPlugin="load" CollectdPluginInstance="" CollectdType="load" CollectdTypeInstance=""/>
    <Counter Category="System" Name="System Up Time" CollectdPlugin="uptime" CollectdPluginInstance="" CollectdType="uptime" CollectdTypeInstance=""/>
    <Counter Category="System" Name="System Calls/sec" CollectdPlugin="system" CollectdPluginInstance="" CollectdType="gauge" CollectdTypeInstance="sys_calls_per_sec"/>
    <Counter Category="System" Name="File Data Operations/sec" CollectdPlugin="io" CollectdPluginInstance="" CollectdType="gauge" CollectdTypeInstance="file_ops_per_sec"/>
    <Counter Category="System" Name="File Read Operations/sec" CollectdPlugin="io" CollectdPluginInstance="" CollectdType="gauge" CollectdTypeInstance="file_read_ops_per_sec"/>
    <Counter Category="System" Name="File Write Operations/sec" CollectdPlugin="io" CollectdPluginInstance="" CollectdType="gauge" CollectdTypeInstance="file_write_ops_per_sec"/>
    <Counter Category="LogicalDisk" Name="% Free Space" Instance="*" CollectdPlugin="df" CollectdPluginInstance="" CollectdType="percent_bytes" CollectdTypeInstance="free"/>
    <Counter Transformer="PercentageToRemainingPercentage" Category="LogicalDisk" Name="% Free Space" Instance="*" CollectdPlugin="df" CollectdPluginInstance="" CollectdType="percent_bytes" CollectdTypeInstance="used"/>
    <Counter Transformer="MegaBytesToBytes" Category="LogicalDisk" Name="Free Megabytes" Instance="*" CollectdPlugin="df" CollectdPluginInstance="" CollectdType="df_complex" CollectdTypeInstance="free"/>
    <Counter Transformer="CountProcessesAndThreads" Category="Process" Name="" CollectdPlugin="processes" CollectdPluginInstance="all" CollectdType="ps_count" CollectdTypeInstance=""/>
    <Counter Category="Process" Name="Handle Count" Instance="_Total" CollectdPlugin="processes" CollectdPluginInstance="" CollectdType="gauge" CollectdTypeInstance="handles"/>
    <Counter Category="Network Interface" Name="Packets Received/Sec,Packets Sent/Sec" Instance="*" CollectdPlugin="interface" CollectdPluginInstance="" CollectdType="if_packets" CollectdTypeInstance=""/>
    <Counter Category="Network Interface" Name="Bytes Received/Sec,Bytes Sent/Sec" Instance="*" CollectdPlugin="interface" CollectdPluginInstance="" CollectdType="if_octets" CollectdTypeInstance=""/>
    <Counter Category="Network Interface" Name="Packets Received Errors,Packets Outbound Errors" Instance="*" CollectdPlugin="interface" CollectdPluginInstance="" CollectdType="if_errors" CollectdTypeInstance=""/>
  </Counters>
</WindowsPerformanceCounter>

Properties

Name Description
RefreshInstancesConfiguration Enable Set to true to refresh WindowsPerformanceCounter instances and thus re-evaluate any new counter instances that might have been added since startup or last configuration load. It works when Instance="*".
RefreshInstancesConfiguration Interval Interval controls how often WindowsPerformanceCounter instances are reloaded. Interval is defined as number of seconds, the default is 900 seconds. This interval is used only if RefreshInstancesConfiguration is enabled.
Counter Category The name of the performance counter category (performance object) with which this performance counter is associated.
Counter Name Comma separated performance counter names
Counter Instance Some performance counters have multiple instances, for example category "LogicalDisk" has an instance for every file system. Either an instance name can be provided or "*" for all instances
Counter Transformer No need to use this attribute if the metric value is directly coming from WindowsPerformanceCounter. Use it when you want to do transformation of the values returned by WindowsPerformanceCounter. See Available Transformers and its Parameters for details.
Counter TransformerParameters No need to use this attribute if Transformer is not defined or Transformer does not need parameters. See Available Transformers and its Parameters for details.
Counter CollectdPlugin Collectd plugin name
Counter CollectdPluginInstance Collectd plugin instance name. For multi-instance performance counter, if above "Instance" field is "*", then this field will be copied over from actual "Instance" value
Counter CollectdType Collectd type name, this field should be already defined in types.db
Counter CollectdTypeInstance Collectd type instance

Available Transformers and its Parameters

Transformer Description Parameters
MegaBytesToBytes Convert megabytes to bytes N/A
PercentageToRemainingPercentage Convert percentage to its opposite percentage (100 - percentage) N/A
MemoryAvailableBytesToUsedPercentage Convert available memory in bytes to used memory in percentage N/A
Average Average the metric in intervals in seconds Average Intervals in seconds. e.g. "60, 300, 900"
CountInstances Count the number of instances of the performance counter N/A
CountProcessesAndThreads Get the total number of processes and threads N/A

Clone this wiki locally