Skip to main content

Posts

Showing posts with the label SQL Server CPU Alerts

Get email alert when number of queries waiting for CPU exceeds thresold

You may have situations where the CPU % usage is well below the alert threshold but still queries are running slow because they are waiting for CPU to be available. This script creates an alert to send out email if the number of queries waiting for CPU exceeds the threshold.  Please update the value for the  @ operator  variable to whatever is the email operator you have setup in the SQL Server Agent. And since I am testing I am using the threshold value of 10. You may want to lower that after testing in your environment. Lastly, Since I did not want to get bombarded with emails, I am using the 900 seconds (15 minutes) delay of between alert emails. Please feel free to adjust it to your needs. USE [msdb] GO declare @ operator varchar ( 500 ) -- email operator name declare @ threshold int -- number of queries waiting for the CPU declare @ delay_between_email_alerts int -- this value is in seconds declare @ drop_alert_if_exists bit ...