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

使用 Azure 门户为 Azure SQL 数据库和 Azure Synapse Analytics 创建警报

Applies to:Azure SQL DatabaseAzure Synapse Analytics

本文介绍如何使用 Azure 门户在 Azure SQL 数据库和 Azure Synapse Analytics 专用 SQL 池中设置警报。 当某些指标(例如数据库大小或 CPU 使用率)达到阈值时,警报可以向你发送电子邮件或调用 Webhook。

设置新的警报规则

可以根据监控指标或事件接收 Azure 服务的警报。

  • Metric values - The alert triggers when the value of a specified metric crosses a threshold you assign. For more information, see Metric alerts.
  • 活动日志事件 - 警报可以在发生 每个 事件时都触发,也可以仅在发生特定数量的事件时触发。 有关详细信息,请参阅活动日志警报
  • Resource health - An alert related to the resource health status events, including whether the event was platform or user-initiated. 有关详细信息,请参阅资源运行状况警报

不可以为警报配置许多操作类型,以便在触发警报时执行,包括:

  • 向服务管理员和共同管理员发送电子邮件通知
  • 向指定的其他电子邮件发送电子邮件,包括 Azure Resource Manager 角色。
  • 使用语音提示拨打电话号码
  • 向组发送电话号码
  • 设置 Azure 移动应用通知
  • 启动自动化 runbook
  • 调用 Azure 函数
  • 启动事件中心操作
  • 创建与 ITSM 兼容的票证
  • 选择逻辑应用操作
  • 调用 Webhook 或安全的 Webhook

可使用以下项配置并获取预警规则相关信息:

在 Azure 门户中开始使用新的警报规则

  1. In the Azure portal, locate the resource you are interested in monitoring and select it.
  2. In the resource menu under Monitoring, select Alerts. 对于不同的资源,文本和图标可能会略有不同。
  3. Select the + Create button, then Alert rule.
  4. 在“创建警报规则”页上,“范围”被自动配置为单个资源。

    Note

    为了避免许多独立警报的蔓延,可能需要为订阅、资源组或 Azure SQL 数据库逻辑服务器中某种类型的所有资源配置警报。 Use the Scope tab to change the scope of the new alert rule.

Capture activity peaks or sustained resource stress with alerts on the Metrics signal category.

  1. On the Condition tab, select See all signals and Select a signal from the list of Metrics.

  2. Select the desired metric, for example CPU percentage. Select Apply.

  3. After you select a signal, the Alert logic options appear. 该信号在此资源中的最近活动预览也将显示。

  4. Configure a Threshold type to determine when the alert will take action. Choose Aggregation type, Operator, and Threshold value as desired. 典型阈值包括:静态、最大值、大于、80%。

    Field Description
    Threshold 选择是否应根据静态值或动态值评估阈值。
    A static threshold evaluates the rule by using the threshold value that you configure.
    Dynamic thresholds use machine learning algorithms to continuously learn the metric behavior patterns and calculate the appropriate thresholds for unexpected behavior. 可以详细了解如何对指标警报使用动态阈值
    Operator 选择用于将指标值与阈值进行比较的运算符。
    如果你使用的是动态阈值,则预警规则可以根据同一预警规则中上限和下限的指标行为使用定制的阈值。 选择以下运算符之一:
    - 大于阈值上限或低于阈值下限(默认值)
    - 大于阈值上限
    - 低于阈值下限
    Aggregation type 选择要应用于数据点的聚合函数:Sum、Count、Average、Min 或 Max。
    Threshold value If you selected a static threshold, enter the threshold value for the condition logic.
    Unit If the selected metric signal supports different units, such as bytes, KB, MB, and GB, and if you selected a static threshold, enter the unit for the condition logic.
    Threshold sensitivity If you selected a dynamic threshold, enter the sensitivity level. 敏感度级别会影响触发警报所需的指标系列模式偏差量。
    - High: Thresholds are tight and close to the metric series pattern. 预警规则在偏差最小的情况下触发,因此会生成更多的警报。
    - Medium: Thresholds are less tight and more balanced. 相比高敏感度(默认设置),警报数量更少。
    - Low: Thresholds are loose, allowing greater deviation from the metric series pattern. 只会在偏差较大的情况下触发预警规则,因此生成的警报较少。
    Aggregation granularity 选择用于使用聚合类型函数对数据点进行分组的间隔。 Choose an Aggregation granularity (period) that's greater than the Frequency of evaluation to reduce the likelihood of missing the first evaluation period of an added time series.
    评估频率 选择警报规则的运行频率。 选择小于聚合粒度的频率,以生成用于评估的滑动窗口。
  5. 在“何时评估”下,确定所需的评估频率。 Use the Check every and Lookback period dropdown lists.

  6. Optionally, you can add multiple conditions for this alert, choose the Add condition alert if desired.

  7. 选择“下一步:操作”>

创建新的警报规则

  1. Select an existing Action group from the Select action groups pane, or Create action group in your subscription. 操作组用于定义在发生警报条件时要执行的操作。 此操作定义在触发警报时发生的操作(例如发送电子邮件)。
    1. 或者,使用“使用快速操作”功能创建新的操作组并提供电子邮件或 Azure 移动应用通知目标。
  2. 选择“下一步:详细信息”>
  3. 默认情况下,警报规则的严重性为“3 - 信息性”。 You can adjust the alert rule's Severity as desired.
  4. 提供“警报规则名称”。 提供描述(可选但推荐)。
  5. Under Advanced options:
    1. 确保“创建时启用”,在创建警报规则后立即开始运行。
    2. 默认情况下启用“自动解决警报”选项。 这将使警报成为有状态警报,这意味着当不再满足条件时,警报将得到解决。
  6. 选择“下一步:标记”>
  7. 考虑使用 Azure 标记。 例如,用于确定资源创建者的“所有者”或“创建者”标记,以及确定此系统是生产环境还是开发环境等的“环境”标记。有关详细信息,请参阅为 Azure 资源开发命名和标记策略
  8. 选择“查看 + 创建”。
  9. Select Create. 很快,警报将被激活。

管理警报规则

Note

若要抑制干扰警报,请参阅使用操作规则抑制警报

Existing alerts need to be managed from the Alerts menu in the Azure portal resource menu. 若要查看、暂停、激活、修改和删除现有警报:

  1. On the Alerts pane of your Azure SQL Database, select Alert rules.

    Azure 门户的屏幕截图,其中显示了称为 cpu 的新警报。

  2. 选择单个现有警报规则进行管理。 可以根据你的偏好修改和调整现有的活动规则。 也可以不删除活动规则而是将其挂起。