Querying Windows Performance Counters
In addition to its own metrics, uberAgent can collect data from any Windows performance counter.
To add performance counters we need to edit uberAgent’s configuration. All metrics need to be associated with a timer that defines how often data for the metric is collected. Performance counter metrics can be added to an existing timer or placed in a new timer section.
In order to collect Windows performance counters, field names need to be normalized prior to sending. uberAgent checks if a transformation is required and performs the required steps automatically. More information on this can be found here.
In the following example we configured a new timer that collects data every 60 seconds. We added two performance counters to the timer that collect .NET information for the entire machine and for a specific process (PowerShell). We also added one performance counter that collects the system’s uptime. The result looks like this:
[Timer] Name = Performance counter timer Interval = 60000 Perf counter = \.NET CLR Memory(_Global_)\# Gen 0 Collections Perf counter = \.NET CLR Memory(powershell)\# Gen 0 Collections Perf counter = \System\System Up Time
As you can see, some counter paths have instance names (e.g. powershell) while others do not. Microsoft does not document counter path names well, but there is some information on MSDN.
Some tools require localized performance counter paths. This becomes a problem if you configure paths for machines with different language versions of Windows.
uberAgent uses only language-neutral paths and is not affected by this problem.
To find the paths for your counters you can use the following method.
Add the desired counters to Performance Monitor. Then right-click the graph section of Perfmon’s window, select “Save settings as…”, save as web page (*.html) and locate the counter path in the HTML code. Perfmon saves the counter path in language-neutral format, which is what is uberAgent needs.