如何创建更新管理警报How to create alerts for Update Management

Azure 中的警报会主动通知你 runbook 作业、服务运行状况问题或与自动化帐户相关的其他情况的结果。Alerts in Azure proactively notify you of results from runbook jobs, service health issues, or other scenarios related to your Automation account. Azure 自动化不包括预配置的警报规则,但你可以基于其生成的数据创建自己的警报规则。Azure Automation does not include pre-configured alert rules, but you can create your own based on data that it generates. 本文介绍如何使用更新管理附带的指标创建警报规则。This article provides guidance on creating alert rules using the metrics included with Update Management.

可用度量值Available metrics

Azure 自动化创建两个不同的平台指标,它们与收集并转发到 Azure Monitor 的更新管理相关。Azure Automation creates two distinct platform metrics related to Update Management that are collected and forwarded to Azure Monitor. 使用指标资源管理器 时,可以使用这些指标进行分析,并使用指标警报规则发出警报。These metric are available for analysis using Metrics Explorer and for alerting using a metrics alert rule.

发出的两个指标为:The two metrics emitted are:

  • 更新部署计算机运行总数Total Update Deployment Machine Runs
  • 更新部署运行总数Total Update Deployment Runs

用于警报时,这两个指标都支持包含附加信息的维度,以帮助将警报的范围限定为特定的更新部署详细信息。When used for alerts, both metrics support dimensions that carry additional information to help scope the alert to a specific update deployment detail. 下表显示了有关配置警报时可用的指标和维度的详细信息。The following table shows the details about the metric and dimensions available when configuring an alert.

信号名称Signal Name 维度Dimensions 说明Description
Total Update Deployment Runs - 更新部署名称- Update Deployment Name
- 状态- Status
针对更新部署的总体状态的警报。Alerts on the overall status of an update deployment.
Total Update Deployment Machine Runs - 更新部署名称- Update Deployment Name
- 状态- Status
- 目标计算机- Target Computer
- 更新部署运行 ID- Update Deployment Run ID
针对特定计算机的更新部署状态的警报。Alerts on the status of an update deployment targeted at specific machines.

创建警报Create alert

按照以下步骤设置警报,以获取更新部署的状态。Follow the steps below to set up alerts to let you know the status of an update deployment. 如果不熟悉 Azure 警报,请参阅 Azure 警报概述If you are new to Azure alerts, see Azure Alerts overview.

  1. 在自动化帐户中,选择“监视”下的“警报”,再选择“新建警报规则” 。In your Automation account, select Alerts under Monitoring, and then select New alert rule.

  2. 在“创建警报规则”页上,系统已选择你的自动化帐户作为资源。On the Create alert rule page, your Automation account is already selected as the resource. 如果要对其进行更改,请选择“编辑资源”。If you want to change it, select Edit resource.

  3. 在“选择资源”页上,从“按资源类型筛选”下拉列表中选择“自动化帐户” 。On the Select a resource page, choose Automation Accounts from the Filter by resource type dropdown list.

  4. 选择要使用的自动化帐户,再选择“完成”。Select the Automation account that you want to use, and then select Done.

  5. 选择“添加条件”以选择适合要求的内容。Select Add condition to chose the signal that's appropriate for your requirement.

  6. 对于维度,请从列表中选择一个有效值。For a dimension, select a valid value from the list. 如果所需的值不在列表中,请选择维度旁边的 +,并键入自定义名称。If the value you want isn't in the list, select + next to the dimension and type in the custom name. 然后选择要查找的值。Then select the value to look for. 若要为某个维度选择所有值,请选择“选择 *”按钮。If you want to select all values for a dimension, select the Select * button. 如果没有为某个维度选择值,更新管理将忽略该维度。If you don't choose a value for a dimension, Update Management ignores that dimension.

    配置信号逻辑

  7. 在“警报逻辑”中的“时间聚合”和“阈值”字段中输入值,然后选择“完成” 。Under Alert logic, enter values in the Time aggregation and Threshold fields, and then select Done.

  8. 在下一页上,输入警报的名称和描述。On the next page, enter a name and a description for the alert.

  9. 对于成功的运行,请将“严重性”字段设置为“信息(严重性 2)”;对于失败的运行,请将其设置为“信息(严重性 1)” 。Set the Severity field to Informational(Sev 2) for a successful run or Informational(Sev 1) for a failed run.

    配置信号逻辑

  10. 选择“是”以启用预警规则。Select Yes to enable the alert rule.

配置警报对应的操作组Configure action groups for your alerts

配置警报后,可以设置操作组,即用于多个警报的一组操作。Once you have your alerts configured, you can set up an action group, which is a group of actions to use across multiple alerts. 这些操作可能包括电子邮件通知、Runbook、Webhook 等。The actions can include email notifications, runbooks, webhooks, and much more. 若要了解有关操作组的详细信息,请参阅创建和管理操作组To learn more about action groups, see Create and manage action groups.

  1. 选择警报,然后在“操作组”下选择“新建” 。Select an alert and then select Create New under Action Groups.

  2. 输入操作组的全名和短名称。Enter a full name and a short name for the action group. 使用指定的组发送通知时,更新管理将使用短名称。Update Management uses the short name when sending notifications using the specified group.

  3. 在“操作”下,输入指定操作的名称,例如“电子邮件通知” 。Under Actions, enter a name that specifies the action, for example, Email Notification.

  4. 对于“操作类型”,选择适当的类型,例如“电子邮件/短信” 。For Action Type, select the appropriate type, for example, Email/SMS.

  5. 选择“编辑详细信息”。Select Edit details.

  6. 填写操作类型的窗格。Fill in the pane for your action type. 例如,如果使用“电子邮件/短信”,请输入操作名称,选择“电子邮件”复选框,输入有效的电子邮件地址,然后单击“确定” 。For example, if using Email/SMS, enter an action name, select the Email checkbox, enter a valid email address, and then select OK.

    配置电子邮件操作组

  7. 在“添加操作组”窗格中,选择“确定”。In the Add action group pane, select OK.

  8. 对于警报电子邮件,你可以自定义电子邮件主题。For an alert email, you can customize the email subject. 在“创建规则”下选择“自定义操作”,然后选择“电子邮件主题” 。Select Customize actions under Create rule, then select Email subject.

  9. 完成后,请选择“创建警报规则”。When you're finished, select Create alert rule.