# Custom Performance Counters

> Configure the agent to collect arbitrary Windows performance counters as custom counters.

Source: https://docs.capaone.com/performanceguard/technical-reference/agents/custom-performance-counters/  
Product: PerformanceGuard — a separate CapaSystems product; do not apply this page to any other.

The PerformanceGuard agent is able to collect arbitrary Windows performance counters. Such counters are referred to as *custom counters*.

# **Configuration Syntax**

Collection of custom counters is controlled by lines in the configuration. The following syntax is supported:

## **EBF for custom counter definition**

**PowerShell**

```powershell
CustomCounterNameLine = "CustomCounter." Id " = " NameDef 
CustomCounterTiming = "CustomCounterTiming". Id " = "<" SampleInterval ";" ReportInterval ">" 
CustomCounterTimeFactor = "CustomCounterTimeFactor." integerId = integer NameDef = PerfObject "(" Instance ")\" Counter | PerfObject "\" Counter 
PerfObject = CounterId
Instance = CounterId
Counter = CounterId CounterId = CounterIdChar {CounterIdChar} 
CounterIdChar = ? any printable character except backslash ? 
SampleInterval = integer
ReportInterval = integer
```

## **Samples**

**PowerShell**

```powershell
CustomCounter.1 = RAS Total\Bytes Received
CustomCounterTiming.1 = <5;30>
CustomCounter.2 = Search Indexer(_Total)\Index Size
CustomCounterTiming.2 = <10;30>
```

# **Sampling and Reporting Intervals**

Sampling and reporting intervals for custom counters are specified in seconds per custom counter template.  
Sampling interval controls how often a counter is sampled. A value of 1 means that the counter should be sampled every second.  
Reporting interval controls how often agents should calculate min, max, sum and count. A value of 5 means that agents should calculate this every five seconds. The reporting interval thus has a direct impact on the amount of data from agents that PerformanceGuard needs to store and process.

# **Counter and Object Name Localization**

Counter object names, and counter names are always in English, even on computers where localized names exist. PerformanceGuard will look up supplied object and counter names using the name index stored in:

**PowerShell**

```powershell
HKLM\SOFTWARE\Microsoft Windows NT\CurrentVersion\Perflib\009
```

:::tip
You can find an overview of performance objects and counters at [**Microsoft Technet**](https://technet.microsoft.com/en-us/).
:::

# **Counter Values**

In previous PerformanceGuard versions, the sampled values were the raw typeless numeric values. That meant that a counter such as the *Datagrams/sec* counter on IPv4 would collect the total number of datagrams sent since the IPv4 TCP stack was loaded, and not the rate of datagrams over time. In other words, the collected data would be an increasing monotonic sequence.  
From PerformanceGuard 6.3, the sampled values are "cooked" values, resembling what you can typically view with Windows' Performance Monitor. If we look at the *Datagrams/sec* counter example from before, you'll now get the actual rate of datagrams over time.

# **Instance-Aware Counters**

Instance-aware counters are not available in the counter tool if they don't have any associated instances.
