设置有关 Azure 事件网格指标和活动日志的警报Set alerts on Azure Event Grid metrics and activity logs

本文介绍如何创建有关 Azure 事件网格指标和活动日志操作的警报。This article describes how to create alerts on Azure Event Grid metrics and activity log operations. 可以针对 Azure 事件网格资源(主题和域)的发布和交付这两种指标创建警报。You can create alerts on both publish and delivery metrics for Azure Event Grid resources (topics and domains). 对于系统主题,请使用“指标”页创建警报For system topics, create alerts using the Metrics page.

创建有关死信事件的警报Create alerts on dead-lettered events

以下过程演示如何针对自定义主题的死信事件指标创建警报。The following procedure shows you how to create an alert on dead-lettered events metric for a custom topic. 在此示例中,如果某个主题的死信事件计数超过 10,则会向 Azure 资源组所有者发送一封电子邮件。In this example, an email is sent to the Azure resource group owner when the dead-lettered event count for a topic goes above 10.

  1. 在主题的“事件网格主题”页上,选择左侧菜单中的“警报”,然后选择“+ 新建警报规则” 。On the Event Grid Topic page for your topic, select Alerts on the left menu, and then select +New alert rule.

    “警报”页 -“新建警报规则”按钮

  2. 在“创建警报规则”页上,验证是否已为资源选择了主题。On the Create alert rule page, verify that your topic is selected for the resource. 然后,单击“选择条件”。Then, click Select condition.

    “警报”页 - 选择条件

  3. 在“配置信号逻辑”页上,执行以下步骤:On the Configure signal logic page, follow these steps:

    1. 选择指标或活动日志条目。Select a metric or an activity log entry. 在此示例中,选择的是“死信事件”。In this example, Dead Lettered Events is selected.

      选择死信事件

    2. 选择维度(可选)。Select dimensions (optional).

      配置信号逻辑

      备注

      可以选择 EventSubscriptionName 的 + 按钮,以指定用于筛选事件的事件订阅名称。You can select + button for EventSubscriptionName to specify an event subscription name to filter events.

    3. 向下滚动。Scroll down. 在“警报逻辑”部分中,选择“运算符”、“聚合类型”,再输入“阈值”,然后选择“完成” 。In the Alert logic section, select an Operator, Aggregation type, and enter a Threshold value, and select Done. 在此示例中,当死信事件总计数大于 10 时会触发警报。In this example, an alert is triggered when the total dead lettered events count is greater than 10.

      警报逻辑

  4. 返回“创建警报规则”页,单击“选择操作组” 。Back on the Create alert rule page, click Select action group.

    “选择操作组”按钮

  5. 选择工具栏上的“创建操作组”,以创建一个新操作组。Select Create action group on the toolbar to create a new action group. 也可以选择现有的操作组。You can also select an existing action group.

  6. 在“添加操作组”页上,执行以下步骤:On the Add action group page, follow these steps:

    1. 输入操作组的名称。Enter a name for the action group.

    2. 为操作组输入“短名称”。Enter a short name for the action group.

    3. 选择要在其中创建该操作组的“Azure 订阅”。Select an Azure subscription in which you want to create the action group.

    4. 选择要在其中创建该操作组的“Azure 资源组”。Select the Azure resource group in which you want to create the action group.

    5. 输入操作的名称。Enter a name for the action.

    6. 选择操作类型。Select the action type. 在此示例中,选择的是“向 Azure 资源管理器角色发送电子邮件”,确切来说是“所有者”角色 。In this example, Email Azure Resource Manager Role is selected, specifically the Owners role.

    7. 选择“确定”关闭页面。Select OK to close the page.

      “添加操作组”页

  7. 返回“创建警报规则”页,输入警报规则的名称,然后选择“创建警报规则” 。Back on the Create alert rule page, enter a name for the alert rule, and then select Create alert rule.

    预警规则名称

  8. 现在,在主题的“警报”页上,可以看到用于管理警报规则的链接(如果尚无警报)。Now, on the Alerts page of the topic, you see a link to manage alert rules if there are no alerts yet. 如果有警报,请选择工具栏上的“管理警报规则”。If there are alerts, select Manager alert rules on the toolbar.

    管理警报

创建有关其他指标或活动日志操作的警报Create alerts on other metrics or activity log operations

上一部分介绍了如何针对死信事件创建警报。The previous section showed you how to create alerts on dead-lettered events. 对于创建有关其他指标或活动日志操作的警报,步骤是相似的。The steps for create alerts on other metrics or activity log operations are similar.

例如,若要针对交付失败事件创建警报,请在“配置信号逻辑”页上选择“交付失败的事件” 。For example, to create an alert on a delivery failure event, select Delivery failed events on the Configure signal logic page.

选择“交付失败的事件”

使用“指标”页创建警报Create alerts using the Metrics page

也可以通过使用“指标”页创建警报。You can also create alerts by using the Metrics page. 步骤是相似的。The steps are similar. 对于系统主题,只能使用“指标”页创建警报,因为“警报”页面不可用 。For system topics, you can only use the Metrics page to create alerts, as the Alerts page isn't available.

“指标”页 -“创建警报”按钮

备注

本文并未涉及创建警报时所有可以使用的不同步骤和组合。This article doesn't cover all the different steps and combinations that you can use to create an alert. 有关警报的概述,请参阅警报概述For an overview of alerts, see Alerts overview.

后续步骤Next steps