教程:使用警报和操作组监视 Spring 应用资源

注意

Azure Spring Apps 是 Azure Spring Cloud 服务的新名称。 虽然该服务有新名称,但一些地方仍会使用旧名称,我们仍在更新屏幕截图、视频和图形等资产。

本文介绍如何在 Azure Spring Apps 中使用警报和操作组监视 Spring 应用资源。

Azure Spring Apps 警报支持根据可用存储、请求速率和数据用量等条件监视资源。 当速率或条件符合定义的规范时,警报将发送通知。

设置警报管道的过程包括两个步骤:

  1. 设置操作组。

    操作组定义了触发警报时要执行的操作,例如使用电子邮件、短信、Runbook 或 Webhook。 可以在不同的警报之间使用和重用操作组。

  2. 设置预警规则。

    规则根据目标资源、条件、时间聚合和其他因素将指标与操作组绑定。

先决条件

设置操作组

在 Azure 门户中,使用以下步骤:

  1. 转至 Azure Spring Apps 实例。

  2. 在导航窗格中选择“警报”,然后选择“操作组”。

    Screenshot of the Azure portal showing the Alerts page with the Action groups button highlighted.

  3. 在“操作组”页面上,选择“创建”。

    Screenshot of the Azure portal showing the Action groups page with the Create button highlighted.

  4. 在“基本信息”选项卡上的“创建操作组”页中,在“项目详细信息”中进行任何所需的更改。 在“实例详细信息”中,指定“操作组名称”和“显示名称”的设置。

    Screenshot of the Azure portal showing the Create action group page with the Basics tab selected.

  5. 选择“通知”选项卡,然后从下拉菜单中选择“通知类型”。 此操作将打开一个窗格,以定义激活时执行的操作。 此示例显示电子邮件和消息类型。 完成表单,然后选择“确定”。

    Screenshot of the Azure portal showing the Create action group page on the Notifications tab with the pane open that defines the notification type.

  6. 设置“名称”以命名操作组。

  7. 选择“查看 + 创建”,完成操作组的创建。

设置警报

使用以下步骤配置警报:

  1. 在导航窗格中选择“警报”,然后选择“警报规则”。

    Screenshot of the Azure portal showing the Alerts page with the Alert rule button highlighted.

  2. 选择创建

    Screenshot of the Azure portal showing the Alert rules page with the Create button highlighted.

  3. 在“条件”选项卡上的“创建警报规则”页上,必须选择触发警报规则的信号。 选择“查看所有信号”。 在“选择信号”窗格中,选择“CPU 利用率”,然后选择“应用”。

    Screenshot of the Azure portal showing the Create an Alert rule page with the select a signal pane open and App CPU Usage highlighted.

  4. 信号选择确定了要配置的警报逻辑设置。 将“阈值”设置为 75。

    Screenshot of the Azure portal showing the Create an Alert rule page with the alert logic setting for Threshold value highlighted.

    若要详细了解可监视的条件,请参阅 Azure Spring Apps 的指标用户指标选项部分。

  5. 选择“操作”选项卡,然后选择“选择操作组”。 在“选择操作组”窗格中,选择应由规则触发的操作组,例如你之前定义的操作组。

    Screenshot of the Azure portal showing the Select an action group to attach to this alert rule pane with an Action group name highlighted.

  6. 选择“选择” 。

  7. 选择“详细信息”选项卡并设置“严重性”,然后进行任何其他所需的更改。

    Screenshot of the Azure portal showing the Create rule page with Severity in Alert Details highlighted.

    提示

    选择“范围”选项卡以更改规则范围内的资源。 默认情况下,范围是当前的 Azure Spring Apps 实例。

  8. 选择“查看 + 创建”,完成警报规则的创建。

  9. 在“警报规则”页上,验证是否启用了新的警报规则。

    Screenshot of the Azure portal showing the Alert rules page with the rule that was just created enabled.

后续步骤

本文介绍了如何为 Azure Spring Apps 中的应用程序设置警报和操作组。 若要详细了解操作组,请参阅: