Wednesday, October 19, 2016

Getting Perfmon Data

In so many of the SQL Server instances I manage, getting to the console isn't possible (or isn't advisable) and having the ability to get these things via SQL is a great help.


To do that, we can grab a quick select like this, to see the various counters available:


select *
from sys.dm_os_performance_counters



For example, if I wanted to monitor how many user connections I had throughout the day, I could save the results of the query below to a monitoring table.


select *
from sys.dm_os_performance_counters
where object_name = 'MSSQL$WORLDWIDE:General Statistics'
and counter_name = 'User Connections';

No comments:

Post a Comment