[英]How to add Disk Free Space performance counter to Azure Application Insights?
我知道 Azure Application Insights 可以在 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>
我如何实际向该文件添加“可用磁盘空间”和“可用磁盘空间百分比”性能计数器?
另外,旁注,我希望 Application Insights 已经收集了这个,有点令人惊讶的是我们必须不遗余力地添加它。
非常感谢您对此的任何帮助!
请在 ApplicationInsights.config 中尝试以下设置:
<Counters>
<Add PerformanceCounter="\LogicalDisk(_total)\% Free Space" ReportAs="the space perc"/>
<Add PerformanceCounter="\LogicalDisk(_total)\Free Megabytes" ReportAs="the space left"/>
</Counters>
只是添加到 Ivan Yang 的回答中,也可以在代码中完成:
var perfCollectorModule = new PerformanceCollectorModule();
perfCollectorModule.Counters.Add(new PerformanceCounterCollectionRequest(@"\Sales(photo)\# Items Sold", "Photo sales"));
perfCollectorModule.Initialize(TelemetryConfiguration.Active);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.