Over the last year, I have been intentionally seeking out to get feedback from the community via various SQL events, particularly those who plan to use or are currently using Azure SQL Database. A lot of questions have come up about managing Azure SQL Database better – i.e. being more proactive and more responsive in managing Azure SQL Database. One of the ways to be more proactive about your SQL Database is by setting up alerts. As an example, you can create an alert in case DTU goes above 95% – say in the last 5 minutes, so that you can either investigate why this might be or upgrade it to a higher SKU.
This article walks through how you can setup an Alert on Azure SQL DB.
Post your ideas or vote other ideas on Azure SQL Database user voice.
Where are Alerts defined?
On Azure portal, if you navigate to your Azure SQL database > Settings, you will be able to see a list of useful features. One of them is Alert Rules as shown below:
Note: The screenshots and the steps shown here are accurate at the time of writing.
What can you use Alerts for?
You can setup alerts on the following items:
- Blocked by Firewall
- Failed Connections
- Successful Connections
- CPU Percentage
- DTU percentage
- DTU limit
- DTU used
- Log IO percentage
- Data IO percentage
- Sessions percentage
- Total database size
- Database size percentage
- Workers percentage
- In-Memory OLTP sotrage percent (Preview)
In addition you can also set Condition and Threshold values. The options available on Condition are:
- greater than
- greater than or equal to
- less than
- less than or equal to.
Alerts can be setup for periods over the last 5 minutes, 10 minutes, 30 minutes, 45 minutes or 1 hour.
SQL Database owners, contributors and readers can receive the alerts. Or, you can add custom email addresses to receive the alert notifications.
An activated alert will send an email that has enough details on what happened, including the associated Alert rule, the database and server, the metric and the time. Below is an example of an Alert Activated email.
When the condition of the Alert rule is no longer satisfied, an Alert Resolved email will be sent to the designated alert receivers. Below is an example of Alert Resolved email.
Routing Alert to other systems
You can use Webhooks to route Alert notifications to other systems. Read How to configure Webhooks for alerts for further details on how to achieve this.
Automating Alerts with PowerShell
[Added 24 August 2016] Special thanks to Mike Fal (t | b) who investigated and put together a how-to with PowerShell for Alerts soon after this blog post was published. Read Creating Alerts for Azure SQL Database with PowerShell for more details.
Azure SQL Database has a number of built-in intelligence that allows users to be more productive with ease. One of the features that allows this is the Alert capability available for Azure services. This article explains a little deeper on Alerts available for Azure SQL Database. One idea of using Alerts is to help in managing the scale up and scale down of your Azure SQL Database.
I have added links to Azure official documentation below.
Azure SQL Database: Receive alert notifications