Create a CPU status alert for a SQL Server on Azure
Estimated Time: 30 minutes
You have been hired as a Senior Data Engineer to help automate day to day operations of database administration. This automation is to help ensure that the databases for AdventureWorks continue to operate at peak performance as well as provide methods for alerting based on certain criteria.
Note: These exercises may ask you to copy and paste T-SQL code and makes use of existing SQL resources. Please verify that the code has been copied correctly, before executing the code.
Create an alert when a CPU exceeds an average of 80 percent
-
In the search bar at the top of the Azure portal, type SQL, and select SQL databases. Select the AdventureWorksLT database name listed.
-
On the main blade for the AdventureWorksLT database, navigate down to the monitoring section. Select Alerts.
-
Select Create alert rule.
-
In the Select a signal slide out, select CPU percentage.
-
In the Configure signal slide out, select Static for the Threshold property. Then check that the Operator property is Greater than, the Aggregation type is Average. Then in Threshold value enter a value of 80. Select Done.
-
Select the Actions tab.
-
In the Actions tab, select Create action group.
-
On the Action Group screen, type emailgroup in the Action group name field, and then select Next: Notifications.
-
On the Notifications tab, enter the following information:
- Notification type: Email/SMS message/Push/Voice
- Note: When you select this option, a Email/SMS message/Push/Voice flyout will appear. Check the Email property and type the Azure username you signed in with.
- Name: DemoLab
- Notification type: Email/SMS message/Push/Voice
-
Select Review + create, then select Create.
Note: Before you select Create, you can also select Test action group (preview) to test the Alert.
-
An email like this is sent to the email address that you entered, once the rule is created.
With the alert in place, if the CPU usage on average exceeds 80%, an email like this is sent.
Alerts can send you an email or call a web hook when some metric (for example database size or CPU usage) reaches a threshold you define. You’ve just seen how you can easily configure alerts for Azure SQL Databases.