你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

使用 SQL 见解(预览版)创建警报

适用于:Azure SQL 数据库Azure SQL 托管实例

SQL 见解(预览版)包括一组警报规则模板,可用于在 Azure Monitor 中针对常见 SQL 问题创建警报规则。 SQL 见解(预览版)中的警报规则是以 Azure Monitor 日志的 InsightsMetrics 表中存储的性能数据为基础的日志警报规则。

注意

若要使用资源管理器模板创建 SQL 见解(预览版)的警报,请参阅 SQL 见解(预览版)的资源管理器模板示例

注意

如果要请求更多 SQL 见解(预览版)警报规则模板,请使用此页面底部的链接或使用 Azure 门户中的 SQL 见解(预览版)反馈链接发送反馈。

启用警报规则

在 Azure 门户上使用以下步骤在 Azure Monitor 中启用警报。 创建的警报规则将作用于在所选监视配置文件下监视的所有 SQL 资源。 触发警报规则时,它将在特定 SQL 实例或数据库上触发。

注意

还可以创建自定义日志警报规则,方法是对 InsightsMetrics 表中的数据集运行查询,然后将这些查询另存为警报规则。

从 Azure 门户的“Azure Monitor”菜单的“见解”部分,选择“SQL(预览版)” 。 选择“警报”。

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

“警报”窗格将在页面右侧打开。 默认情况下,它会根据已创建的警报规则,显示所选监视配置文件中的 SQL 资源的触发警报。 选择“警报模板”,将显示可用于创建警报规则的可用模板的列表。

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.

在“创建警报规则”页上,检查规则的默认设置,并根据需要对其进行编辑。 还可以选择操作组,用于在触发警报规则时创建通知和操作。 在验证其所有属性后,选择“启用警报规则”以创建警报规则。

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).

若要立即部署警报规则,请选择“部署警报规则”。 如果要在部署规则模板之前对其进行查看,请选择“查看模板”。

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.

如果选择查看模板,请从模板页中选择“部署”以创建警报规则。

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.

后续步骤

详细了解 Azure Monitor 中的警报