Performance Counters

Greetings all,

I manage the monitoring for our Active Directory. I use System Center Operations Manager (SCOM) along with Audit Collection Services (ACS) to do this.

We are having some real performance issues so clients are dropping. This impacts Sarbanes-Oxley (SOx) compliance to some extent so what I want is a website that tells my SOx auditors what the health of the forest is from an ACS perspective. This means I want to publish the Connected client count, the incoming events per second as well as the database queue % full for any one of the ACS collectors.

So I have three counters I want to pull from the collectors. I did a Google search and came up with a few complicated ways of doing this, none of which seemed to work. I could see the counters I wanted in perfmon but they were not available inside Server Explorer in Visual Studio, nor would my code find the ACS Collector category. I searched high and low and came to find that the cause was that the project was set to compile with “any CPU” platform so I had to create an x64 platform and compile to that. Problem solved but not beforeĀ I read the Microsoft documentation and found a simple way to do what I want.

So in my code, it is as simple as this:

if (!PerformanceCounterCategory.Exists(“ACS Collector”)) return;

PerformanceCounter counter = new PerformanceCounter(
“ACS Collector”,
“Connected Clients”,

true);
long connectedClients = counter.RawValue;

counter.CounterName = “Database Queue % Full”;
double dbQueue = counter.RawValue * .000001;

counter.CounterName = “Incoming Events/sec”;

double incomingEvents = (double) counter.RawValue;

counter.Dispose();

Console.WriteLine($”Connected clients: {connectedClients});

Console.WriteLine($”Database Queue: {dbQueue});

Console.WriteLine($”Incoming Events: {incomingEvents});

This code snippet will look for the Microsoft System Center Audit Collection Services counters for connected clients, incoming events per second and database queue and display the values.

Leave a Reply