Skip to content
peschuster edited this page Sep 4, 2012 · 6 revisions

PerfCounterMonitor.exe (Graphite.System)

Besides profiling and instrumenting your code manually you can report various system parameters to StatsD and Graphite, too. This can be accomplished with the Graphite.System block, respectively PerfCounterMonitor.exe.

Graphite.System enables reporting values from the following sources:

  • Performance counters
  • Event log
  • IIS Application Pools

All settings for Graphite.System can be changed and configured in the PerfCounterMonitor.exe.config file.

PerfCounterMonitor.exe can be run as a standalone console application or installed as a Windows service:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe PerfCounterMonitor.exe
net start GraphiteSystemMonitoring

Performance counters

Performance counters are classified by the following three properties: category, counter and instance.

To explore all available performance counters in your system you can call PerfCounterMonitor.exe with the -e parameter.

After the -e paramater a category and instance name can be specified to show more details:

PerfCounterMonitor.exe -e [category [instance]]

Example for displaying all performance counters for category "Processor" and instance "_Total":

PerfCounterMonitor.exe -e Processor "_Total"

PerfCounterMonitor.exe can be configured to periodically report values of any performance counter through the PerfCounterMonitor.exe.config file:

<graphite.system xmlns="http://github.com/peschuster/Graphite/Configuration">
    <counters>
      <clear />
      <add 
        key="processor.time" 
        category="Processor" instance="_Total" counter="% Processor Time" 
        type="gauge" target="statsd" interval="30" />
      <add 
        key="processor.dpc" 
        category="Processor" instance="_Total" counter="DPC Rate" 
        type="gauge" target="statsd" interval="5" />
    </counters>
  </graphite.system>
  • key - the metric key
  • category - the performance counter category name
  • instance - the performance counter instance name
  • counter - the performance counter name
  • type - the metric type as described in General
  • target - the monitoring target (statsd or graphite)
  • interval - the interval in seconds this metric should be read/reported
  • optionally sampling can be specified for StatsD counter types to sample values before submission (reduces number of submitted packets, see http://github.com/etsy/statsd for more details)

Event log

PerfCounterMonitor.exe can report new entries in the event log, too.

For each new entry matching the configured properties, a metric with specified value is reported.

<eventlog>
  <clear />
  <add
    key="admin.errors"
    protocol="Application" entrytypes="Error"
    type="gauge" target="graphite" />
  <add
    key="admin.dotnet.exceptions"
    protocol="Application" source=".NET Runtime" entrytypes="Error"
    type="gauge" target="graphite" />
  <add
    key="admin.dotnet.warnings"
    protocol="Application" source=".NET Runtime" entrytypes="Warning"
    type="gauge" target="graphite" />
</eventlog>
  • key - the metric key
  • protocol - the event log protocol (e.g. "Application", "System", "Security", etc.)
  • source - the log source value.
  • category is optional and specifies the category of the messages
  • entrytypes - type of event log entry to listen for (Error, Warning, Information, SuccessAudit and FailureAudit). Multiple types can be seperated by ";" or ",".
  • target - the monitoring target (statsd or graphite)
  • value is optional (defaults to 1)
  • optionally sampling can be specified for StatsD counter types to sample values before submission (reduces number of submitted packets)

IIS Application Pools

The "working set" (i.e. used memory) of IIS Application Pools can be reported by PerfCounterMonitor.exe.

Therefore the application pool names must be specified in PerfCounterMonitor.exe.config:

<appPool>
  <add key="admin.appPool.default" appPoolName="DefaultApplicationPool" workingSet="true"
    type="gauge" target="statsd" />
  <add key="admin.appPool.asp4" appPoolName="ASP.NET v4.0" workingSet="true"
    type="gauge" target="statsd" />
</appPool>
  • key - the metric key.
  • appPoolName - the application pool name.
  • workingSet - must be true.
  • type - the metric type as described in General.
  • target - the monitoring target (statsd or graphite).
  • interval - the interval in seconds this metric should be read/reported.
Clone this wiki locally