0

Was wondering how I can programmatically get performance metrics for a given sql server instance or database by using SMO (sql management objects). Basically similar to what the Activity Monitor in Sql Management Studio displays.

So for example if I want to know things like the CPU usage, I/O writes, etc, which SMO object will give me that?

I've tried using the following but I don't think I'm on the right track.

Server srv = new Server(conn);

DataRow[] datarows = srv.EnumPerformanceCounters().Select();
N8TRO
  • 3,348
  • 3
  • 22
  • 40
  • Correct. That's what I need. The values for the counters. But I can't find which classes in the SMO namespace(s) do that. – user2147156 Mar 08 '13 at 18:43
  • The EnumPerformanceCounters() method seems to returns information that only indicates the ObjectName, CounterName and InstanceName of a given counter. – user2147156 Mar 08 '13 at 18:50

0 Answers0