Rediger

Del via


Create alerts with SQL Insights (preview)

Applies to: Azure SQL Database Azure SQL Managed Instance

Important

SQL Insights (preview) will be retired on 31 December 2024. We recommend that you transition to database watcher for Azure SQL (preview) or another database monitoring solution by that date.

Database watcher is the recommended monitoring solution for scenarios that require low data collection latency, estate-level monitoring, comprehensive monitoring data including query-level details, and support for advanced analytics on collected monitoring data. At this time, database watcher supports Azure SQL Database and Azure SQL Managed Instance.

After 31 December 2024, SQL Insights (preview) will not be supported and will not be available in the Azure portal. You will retain any existing monitoring data collected by SQL Insights in your Log Analytics workspace.

SQL Insights (preview) includes a set of alert rule templates you can use to create alert rules in Azure Monitor for common SQL issues. The alert rules in SQL Insights (preview) are log alert rules based on performance data stored in the InsightsMetrics table in Azure Monitor Logs.

To create an alert for SQL Insights (preview) using a resource manager template, see Resource Manager template samples for SQL Insights (preview).

Enable alert rules

Use the following steps to enable the alerts in Azure Monitor from the Azure portal. The alert rules that are created will be scoped to all of the SQL resources monitored under the selected monitoring profile. When an alert rule is triggered, it will trigger on the specific SQL instance or database.

You can also create custom log alert rules by running queries on the data sets in the InsightsMetrics table and then saving those queries as an alert rule.

Select SQL (preview) from the Insights section of the Azure Monitor menu in the Azure portal. Select Alerts.

Screenshot of the Azure Monitor page for SQL in the Azure portal. The Alerts button is highlighted.

The Alerts pane opens on the right side of the page. By default, it will display fired alerts for SQL resources in the selected monitoring profile based on the alert rules you've already created. Select Alert templates, which will display the list of available templates you can use to create an alert rule.

Screenshot of the Alerts page for Azure Monitor in the Azure portal. In the tab for Alert templates, a Create rule link for one of the alerts is highlighted.

On the Create Alert rule page, review the default settings for the rule and edit them as needed. You can also select an action group to create notifications and actions when the alert rule is triggered. Select Enable alert rule to create the alert rule once you've verified all of its properties.

Screenshot of the Alert rules page for Azure Monitor in the Azure portal. The Create Alert rule (step 1 of 2) page shows the thresholds to use for alerts, the name and severity of the alert, and an alert group for notifications (optional).

To deploy the alert rule immediately, select Deploy alert rule. Select View Template if you want to view the rule template before actually deploying it.

Screenshot of the Deploy alert rule page for Azure Monitor in the Azure portal. The Create Alert rule (step 2 of 2) page shows 'Ready to deploy your log alert' and the Deploy alert rule button is highlighted.

If you choose to view the templates, select Deploy from the template page to create the alert rule.

Screenshot of the Deploy from view template page for Azure Monitor in the Azure portal, displaying the json of the alert. The Deploy menu button is highlighted.

Learn more about alerts in Azure Monitor.