I have created a PerformanceCounterCategory like below
var category = PerformanceCounterCategory.Create("MyCat", "Cat Help", PerformanceCounterCategoryType.SingleInstance, "MyCounter", "Counter Help);
How can I add a new counter to the category to monitor another item?
I cannot find the api for it.
You'll need to run Visual Studio as an administrator to create the category and counter. PerformanceCounterCategory customCategory = new PerformanceCounterCategory(categoryName); CounterCreationData counterCreationData = new CounterCreationData(firstCounterName, firstCounterHelp, PerformanceCounterType.
Windows Performance Counters provide a high-level abstraction layer that provides a consistent interface for collecting various kinds of system data such as CPU, memory, and disk usage. System administrators often use performance counters to monitor systems for performance or behavior problems.
Performance counters enable us to publish, capture, and analyze the performance data of running code. A performance graph is a two-dimensional plot with one axis indicating time elapsed and the other reporting relevant relative or actual performance statistics.
I did a research on this a while back and it doesn't seem to be possible to add counters to an existing category, what you would have to do it to recreate the same category with addition of the new counter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With