使用 Azure 门户为 Azure SQL 数据库和 Azure Synapse Analytics 数据库创建警报Create alerts for Azure SQL Database and Azure Synapse Analytics databases using Azure portal

概述Overview

本文介绍如何使用 Azure 门户为 Azure SQL 数据库和 Azure Synapse Analytics(以前称为 Azure SQL 数据仓库)中的单一、共用和数据仓库数据库设置警报。This article shows you how to set up alerts for single, pooled, and data warehouse databases in Azure SQL Database and Azure Synapse Analytics (formerly Azure SQL Data Warehouse) using the Azure portal. 当某些指标(例如数据库大小或 CPU 使用率)达到阈值时,警报可以向你发送电子邮件或调用 Webhook。Alerts can send you an email or call a web hook when some metric (for example database size or CPU usage) reaches the threshold. 本文还提供了有关设置警报期限的最佳做法。This article also provides best practices for setting alert periods.

Important

此功能在托管实例中尚不可用。This feature is not yet available in Managed Instance. 作为替代方法,你可以使用 SQL 代理根据动态管理视图发送某些指标的电子邮件警报。As an alternative, you can use SQL Agent to send email alerts for some metrics based on Dynamic Management Views.

可以根据监控指标或事件接收 Azure 服务的警报。You can receive an alert based on monitoring metrics for, or events on, your Azure services.

  • 指标值 - 指定指标的值超过在任一方向分配的阈值时,将触发警报。Metric values - The alert triggers when the value of a specified metric crosses a threshold you assign in either direction. 也就是说,当首次满足条件时,以及之后不再满足条件时,都会触发此警报。That is, it triggers both when the condition is first met and then afterwards when that condition is no longer being met.
  • 活动日志事件 - 每个 事件发生,或仅当出现一定次数的事件时,触发警报。Activity log events - An alert can trigger on every event, or, only when a certain number of events occur.

可配置警报,使警报触发时执行以下操作:You can configure an alert to do the following when it triggers:

  • 向服务管理员和共同管理员发送电子邮件通知Send email notifications to the service administrator and co-administrators
  • 将电子邮件发送到指定的其他电子邮件地址。Send email to additional emails that you specify.
  • 调用 WebhookCall a webhook

可使用以下项配置并获取有关警报规则的信息You can configure and get information about alert rules using

使用 Azure 门户创建指标的警报规则Create an alert rule on a metric with the Azure portal

  1. 在此门户,查找想要监视的资源并选中它。In the portal, locate the resource you are interested in monitoring and select it.

  2. 在“监视”部分中选择“警报”。 Select Alerts in the Monitoring section. 对于不同的资源,文本和图标可能会略有不同。The text and icon may vary slightly for different resources.

    监视

  3. 选择“新建警报规则”按钮以打开“创建规则”页。 Select the New alert rule button to open the Create rule page. 创建规则Create rule

  4. 在“条件”部分中,单击“添加”。 In the Condition section, click Add. 定义条件Define condition

  5. 在“配置信号逻辑”页中,选择一个信号。 In the Configure signal logic page, select a signal. 选择信号Select signal.

  6. 在选择某个信号(例如“CPU 百分比” )后,将会显示“配置信号逻辑” 页。After selecting a signal, such as CPU percentage, the Configure signal logic page appears. 配置信号逻辑Configure signal logic

  7. 在此页面上,配置该阈值类型、运算符、聚合类型、阈值、聚合粒度和评估频率。On this page, configure that threshold type, operator, aggregation type, threshold value, aggregation granularity, and frequency of evaluation. 然后单击“完成” 。Then click Done.

  8. 在“创建规则”中,选择一个现有的“操作组”或创建一个新组。 On the Create rule, select an existing Action group or create a new group. 操作组用于定义在发生警报条件时要执行的操作。An action group enables you to define the action to be taken when an alert condition occurs. 定义操作组Define action group

  9. 定义规则的名称,提供可选说明,为规则选择严重性级别,选择是否在创建规则时启用规则,然后单击“创建规则警报” 以创建指标规则警报。Define a name for the rule, provide an optional description, choose a severity level for the rule, choose whether to enable the rule upon rule creation, and then click Create rule alert to create the metric rule alert.

在 10 分钟后,警报将如前所述激活并触发。Within 10 minutes, the alert is active and triggers as previously described.

后续步骤Next steps