1
votes

I know that Azure Application Insights can collect additional performance counters using this syntax in ApplicationInsights.config:

  <Counters>
    <Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
    ...
  </Counters>

  PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName

  -->
</Add>

How do I actually add "Free Disk Space" and "Free Disk Space %" performance counters to this file?

Also, side note, I wish that Application Insights just already collected this, kind of surprising we have to go to these lengths to add it.

Any help with this is greatly appreciated!

2

2 Answers

3
votes

Please try the settings below in ApplicationInsights.config:

 <Counters>
        <Add PerformanceCounter="\LogicalDisk(_total)\% Free Space" ReportAs="the space perc"/>
        <Add PerformanceCounter="\LogicalDisk(_total)\Free Megabytes" ReportAs="the space left"/>
 </Counters>
0
votes

Just to add to Ivan Yang's answer, it can also be done in code:

var perfCollectorModule = new PerformanceCollectorModule();
perfCollectorModule.Counters.Add(new PerformanceCounterCollectionRequest(@"\Sales(photo)\# Items Sold", "Photo sales"));
perfCollectorModule.Initialize(TelemetryConfiguration.Active);

System performance counters in Application Insights