创建有关服务通知的活动日志警报Create activity log alerts on service notifications

概述Overview

本文演示如何使用 Azure 门户设置活动日志警报,用于通知服务运行状况。This article shows you how to set up activity log alerts for service health notifications by using the Azure portal.

服务运行状况通知存储在 Azure 活动日志中;鉴于活动日志中存储的信息量可能很大,因此有一个单独的用户界面,以便更轻松地查看和设置有关服务运行状况通知的警报。Service health notifications are stored in the Azure activity log Given the possibly large volume of information stored in the activity log, there is a separate user interface to make it easier to view and set up alerts on service health notifications.

当 Azure 将服务运行状况通知发送到 Azure 订阅时,可以收到警报。You can receive an alert when Azure sends service health notifications to your Azure subscription. 可以基于以下内容配置警报:You can configure the alert based on:

  • 服务运行状况通知的类别(服务问题、计划内维护、运行状况公告)。The class of service health notification (Service issues, Planned maintenance, Health advisories).
  • 受影响的订阅。The subscription affected.
  • 受影响的服务。The service(s) affected.
  • 受影响的区域。The region(s) affected.

备注

服务运行状况通知不会发送有关资源运行状况事件的警报。Service health notifications does not send an alert regarding resource health events.

还可以配置向其发送警报的人员:You also can configure who the alert should be sent to:

  • 选择现有操作组。Select an existing action group.
  • 创建新操作组(可以用于将来的警报)。Create a new action group (that can be used for future alerts).

若要了解有关操作组的详细信息,请参阅创建和管理操作组To learn more about action groups, see Create and manage action groups.

有关如何使用 Azure 资源管理器模板配置服务运行状况通知警报的信息,请参阅资源管理器模板For information on how to configure service health notification alerts by using Azure Resource Manager templates, see Resource Manager templates.

使用 Azure 门户发出警报和新建操作组Alert and new action group using Azure portal

  1. 门户中,选择“服务运行状况” 。In the portal, select Service Health.

    “服务运行状况”服务

  2. 在“警报” 部分中,选择“运行状况警报” 。In the Alerts section, select Health alerts.

    “运行状况警报”选项卡

  3. 选择“创建服务运行状况警报” ,并填写字段。Select Create service health alert and fill in the fields.

    “创建服务运行状况警报”命令

  4. 选择要针对其发出警报的订阅服务区域Select the Subscription, Services, and Regions you want to be alerted for.

    “添加活动日志警报”对话框

备注

此订阅用于保存活动日志警报。This subscription is used to save the activity log alert. 警报资源部署到此订阅,并在其中监视活动日志事件。The alert resource is deployed to this subscription and monitors events in the activity log for it.

  1. 选择要针对其发出警报的事件类型:“服务问题” 、“计划内维护” 和“运行状况公告” Choose the Event types you want to be alerted for: Service issue, Planned maintenance, and Health advisories

  2. 通过输入警报规则名称说明定义警报详细信息。Define your alert details by entering an Alert rule name and Description.

  3. 选择要将警报保存到的资源组Select the Resource group where you want the alert to be saved.

  4. 通过选择“新建操作组” 创建一个新操作组。Create a new action group by selecting New action group. 在“操作组名称” 框中输入名称,然后在“短名称” 框中输入名称。Enter a name in the Action group name box and enter a name in the Short name box. 在触发此警报时,将引用已发送通知中的短名称。The short name is referenced in the notifications that are sent when this alert fires.

    创建新的操作组

  5. 通过提供接收方来定义接收方的列表:Define a list of receivers by providing the receiver's:

    a.a. 名称:输入接收方的名称、别名或标识符。Name: Enter the receiver's name, alias, or identifier.

    b.b. 操作类型:选择短信、电子邮件、Webhook、Azure 应用等。Action Type: Select SMS, email, webhook, Azure app, and more.

    c.c. 详细信息:根据所选操作类型,输入电话号码、电子邮件地址、Webhook URI 等。Details: Based on the action type chosen, enter a phone number, email address, webhook URI, etc.

  6. 选择“确定” 以创建操作组,然后选择“创建警报规则” 以完成警报。Select OK to create the action group, and then Create alert rule to complete your alert.

在几分钟内,警报将处于活动状态,并根据创建期间指定的条件开始触发。Within a few minutes, the alert is active and begins to trigger based on the conditions you specified during creation.

有关活动日志警报的 webhook 架构的信息,请参阅 Azure 活动日志警报的 WebhookFor information on the webhook schema for activity log alerts, see Webhooks for Azure activity log alerts.

备注

这些步骤中定义的操作组可以作为现有操作组重复用于所有未来的警报定义。The action group defined in these steps is reusable as an existing action group for all future alert definitions.

使用 Azure 门户通过现有操作组发出警报Alert with existing action group using Azure portal

  1. 执行上一节中的步骤 1 至 6 来创建服务运行状况通知。Follow steps 1 through 6 in the previous section to create your service health notification.

  2. 在“定义操作组” 下,单击“选择操作组” 按钮。Under Define action group, click the Select action group button. 选择适当的操作组。Select the appropriate action group.

  3. 选择“添加” 以添加操作组,然后选择“创建警报规则” 以完成警报。Select Add to add the action group, and then Create alert rule to complete your alert.

在几分钟内,警报将处于活动状态,并根据创建期间指定的条件开始触发。Within a few minutes, the alert is active and begins to trigger based on the conditions you specified during creation.

使用 Azure 资源管理器模板发出警报和新建操作组Alert and new action group using the Azure Resource Manager templates

下面是创建以电子邮件为目标的操作组,并为目标订阅启用所有服务运行状况通知的示例。The following is an example that creates an action group with an email target and enables all service health notifications for the target subscription.

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "actionGroups_name": {
            "defaultValue": "SubHealth",
            "type": "String"
        },
        "activityLogAlerts_name": {
            "defaultValue": "ServiceHealthActivityLogAlert",
            "type": "String"
        },
        "emailAddress":{
            "type":"string"
        }
    },
    "variables": {
        "alertScope":"[concat('/','subscriptions','/',subscription().subscriptionId)]"
    },
    "resources": [
        {
            "comments": "Action Group",
            "type": "microsoft.insights/actionGroups",
            "name": "[parameters('actionGroups_name')]",
            "apiVersion": "2017-04-01",
            "location": "Global",
            "tags": {},
            "scale": null,
            "properties": {
                "groupShortName": "[parameters('actionGroups_name')]",
                "enabled": true,
                "emailReceivers": [
                    {
                        "name": "[parameters('actionGroups_name')]",
                        "emailAddress": "[parameters('emailAddress')]"
                    }
                ],
                "smsReceivers": [],
                "webhookReceivers": []
            },
            "dependsOn": []
        },
        {
            "comments": "Service Health Activity Log Alert",
            "type": "microsoft.insights/activityLogAlerts",
            "name": "[parameters('activityLogAlerts_name')]",
            "apiVersion": "2017-04-01",
            "location": "Global",
            "tags": {},
            "scale": null,
            "properties": {
                "scopes": [
                    "[variables('alertScope')]"
                ],
                "condition": {
                    "allOf": [
                        {
                            "field": "category",
                            "equals": "ServiceHealth"
                        },
                        {
                            "field": "properties.incidentType",
                            "equals": "Incident"
                        }
                    ]
                },
                "actions": {
                    "actionGroups": [
                        {
                            "actionGroupId": "[resourceId('microsoft.insights/actionGroups', parameters('actionGroups_name'))]",
                            "webhookProperties": {}
                        }
                    ]
                },
                "enabled": true,
                "description": ""
            },
            "dependsOn": [
                "[resourceId('microsoft.insights/actionGroups', parameters('actionGroups_name'))]"
            ]
        }
    ]
}

管理警报Manage your alerts

创建警报之后,可在“监视” 的“警报” 部分中查看。After you create an alert, it's visible in the Alerts section of Monitor. 选择要管理的警报:Select the alert you want to manage to:

  • 编辑它。Edit it.
  • 删除它。Delete it.
  • 如果要暂时停止或恢复接收警报的通知,可“禁用”或“启用”它。Disable or enable it, if you want to temporarily stop or resume receiving notifications for the alert.

后续步骤Next steps