How can I add a performance counter to a category i have already created
-
12-09-2019 - |
Question
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.
Solution
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.
OTHER TIPS
PerformanceCounter lCounter = new PerformanceCounter(Category, CounterName,
false);
lCounter.MachineName = ".";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow