July 26, 2015 at 5:03 am
hi, could you please explain how to create alert for high cup utilization
thanks
msrao
July 26, 2015 at 10:51 pm
Actually, it's not something easily done from SQL Server and probably should not be. It should be done from Windows. Here's a link about setting up such alerts from Windows.
If you insist on doing such a thing from SQL Server, you can try incorporating one of the following into a job.
SELECT instance_name
,[CPU%] = SUM(CASE WHEN counter_name = 'CPU usage %' THEN cntr_value*100.0 ELSE 0.0 END)
/ SUM(CASE WHEN counter_name = 'CPU usage % base' THEN cntr_value ELSE 1.0 END)
FROM sys.dm_os_performance_counters
WHERE object_name = 'SQLServer:Resource Pool Stats'
AND counter_name IN ('CPU usage %','CPU usage % base')
GROUP BY instance_name
;
EXEC xp_CmdShell 'wmic cpu get loadpercentage'
;
EXEC xp_CmdShell 'typeperf "\processor(_Total)\% Processor Time" -SC 1 -y';
Keep in mind that those last two methods are "instantaneous values".
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply