ARMS告警管理支持将告警生命周期中告警的状态变更(如告警产生,认领,关闭等)投递到您的EventBridge消息总线中。您可以通过消费EventBridge事件来对接三方系统,从而实现如自愈(automated remediation)或者工单集成等能力。本文介绍如何将ARMS告警管理的事件投递到EventBridge消息总线中。

背景信息

事件总线EventBridge是阿里云提供的一款无服务器事件总线服务,支持阿里云服务、自定义应用、SaaS应用以标准化、中心化的方式接入,并能够以标准化的CloudEvents 1.0协议在这些应用之间路由事件,帮助您轻松构建松耦合、分布式的事件驱动架构。更多信息,请参见什么是事件总线EventBridge

步骤一: 创建EventBridge资源

  1. 创建EventBridge事件总线。具体操作,请参见管理自定义事件总线
    创建完成后,在总线概览页面获取事件总线的公网接入点。事件总线公网地址
  2. 添加自定义应用类型的事件源。具体操作,请参见管理自定义事件源
    自定义事件源

步骤二:在ARMS中配置EventBridge集成

  1. 登录ARMS控制台,在左侧导航栏选择告警管理 > 集成
  2. 集成页面单击通知集成页签,然后单击EventBridge
  3. 添加集成对话框配置以下参数,然后单击保存
    参数 说明
    名称 自定义集成的名称,例如:EventBridge集成。
    描述 集成的描述,选填。
    Endpoint 步骤一中获取的公网访问Endpoint。
    AccessKey 阿里云账号的AccessKey。获取方式,请参见获取AccessKey
    AccessKey Secret 阿里云账号的AccessKey Secret。获取方式,请参见获取AccessKey
    消息总线名称 步骤一中创建的消息总线的名称。例如:armstest。
    regionId 步骤一中创建的消息总线所在的地域ID,例如:cn-hangzhou。
    事件源名称 步骤一中创建的事件源名称。例如:arms。

步骤三:配置通知策略

在通知策略中配置工单系统为上一步创建的EventBridge集成。具体操作,请参见通知策略

步骤四:在EventBridge控制台查看告警事件

登录EventBridge控制台查看告警事件。具体操作,请参见查询事件EventBridge告警事件
事件类型Code 类型
aliyun:arms:alarm:create 告警发生事件
aliyun:arms:alarm:claim 告警认领事件
aliyun:arms:alarm:comment 告警评论事件
aliyun:arms:alarm:close 告警关闭事件
单击目标事件操作列的事件详情,可以查看事件的参数信息。各类型事件的事件详情格式如下:
  • 告警发生事件
    {
        "datacontenttype": "application/json",
        "aliyunaccountid": "11xxxxxxxxxxx",
        "data": {
            "owner": "xx",  //告警责任人,配置在通知策略中的联系人
            "data": {        // 告警内容,兼容开源AlertManager事件格式,请参见Prometheus官方文档 https://prometheus.io/docs/alerting/latest/configuration/?spm=a2c4g.11186623.0.0.179176a6M4TIb5#webhook_config
                "alerts": [
                    {
                        "fingerprint": "9b115ab3762a47b51a8efcb516d4aa50",
                        "annotations": {
                            "message": "手动触发的测试告警"
                        },
                        "startsAt": "2022-06-07T09:22:01.645000000Z",
                        "endsAt": "2022-06-07T09:27:39.099000000Z",
                        "labels": {
                            "severity": "error",
                            "regionId": "cn-hangzhou",
                            "_aliyun_arms_denoise_code": "0",
                            "_aliyun_arms_integration_name": "自定义集成",
                            "alertname": "手动触发的告警",
                            "_aliyun_arms_product_type": "CUSTOM",
                            "_aliyun_arms_userid": "11xxxxxxxxxxx",
                            "_aliyun_arms_integration_id": "616",
                            "_aliyun_arms_is_denoise_filtered": "false"
                        },
                        "status": "firing"
                    }
                ],
                "commonLabels": {
                    "severity": "error",
                    "regionId": "cn-hangzhou",
                    "_aliyun_arms_denoise_code": "0",
                    "_aliyun_arms_integration_name": "自定义集成",
                    "alertname": "手动触发的告警",
                    "_aliyun_arms_product_type": "CUSTOM",
                    "_aliyun_arms_userid": "11xxxxxxxxxxx",
                    "_aliyun_arms_integration_id": "616",
                    "_aliyun_arms_is_denoise_filtered": "false"
                },
                "externalURL": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",
                "groupLabels": {
                    "alertname": "手动触发的告警"
                },
                "receiver": "",
                "level": "P2",
                "dispatchRuleName": "日常运维团队",
                "startTime": "2022-06-07 17:22:01",
                "commonAnnotations": {
                    "message": "手动触发的测试告警"
                },
                "status": "firing"
            },
            "timestamp": 1654593783951
        },
        "subject": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",   //告警定位url,全局唯一
        "aliyunoriginalaccountid": "11xxxxxxxxxxx",
        "source": "arms",
        "type": "aliyun:arms:alarm:create",
        "aliyunpublishtime": "2022-06-07T09:23:04.003Z",
        "specversion": "1.0",
        "aliyuneventbusname": "armstest",
        "id": "d997f8c775d4d15b05f3346d5863fdc6******_create",
        "aliyunregionid": "cn-hangzhou",
        "aliyunpublishaddr": "xx.xx.xx.xx"
    }
  • 告警认领事件
    {
        "datacontenttype": "application/json",
        "aliyunaccountid": "11xxxxxxxxxxx",
        "data": {
            "owner": "xx", //责任人
            "handler": "xx", //处理人
            "data": { // 告警内容,兼容开源AlertManager事件格式,请参见Prometheus官方文档 https://prometheus.io/docs/alerting/latest/configuration/?spm=a2c4g.11186623.0.0.179176a6M4TIb5#webhook_config
                "alerts": [
                    {
                        "fingerprint": "9b115ab3762a47b51a8efcb516d4aa50",
                        "annotations": {
                            "message": "手动触发的测试告警"
                        },
                        "startsAt": "2022-06-07T09:20:43.780000000Z",
                        "endsAt": "2022-06-07T09:25:43.780000000Z",
                        "labels": {
                            "severity": "error",
                            "regionId": "cn-hangzhou",
                            "_aliyun_arms_denoise_code": "0",
                            "_aliyun_arms_integration_name": "自定义集成",
                            "alertname": "手动触发的告警",
                            "_aliyun_arms_product_type": "CUSTOM",
                            "_aliyun_arms_userid": "11xxxxxxxxxxx",
                            "_aliyun_arms_integration_id": "616",
                            "_aliyun_arms_is_denoise_filtered": "false"
                        },
                        "status": "firing"
                    }
                ],
                "commonLabels": {
                    "severity": "error",
                    "regionId": "cn-hangzhou",
                    "_aliyun_arms_denoise_code": "0",
                    "_aliyun_arms_integration_name": "自定义集成",
                    "alertname": "手动触发的告警",
                    "_aliyun_arms_product_type": "CUSTOM",
                    "_aliyun_arms_userid": "11xxxxxxxxxxx",
                    "_aliyun_arms_integration_id": "616",
                    "_aliyun_arms_is_denoise_filtered": "false"
                },
                "externalURL": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",
                "groupLabels": {
                    "alertname": "手动触发的告警"
                },
                "receiver": "",
                "level": "P2",
                "dispatchRuleName": "日常运维团队",
                "startTime": "2022-06-07 17:20:43",
                "commonAnnotations": {
                    "message": "手动触发的测试告警"
                },
                "status": "firing"
            },
            "operator": "xx", //操作人
            "timestamp": 1654593717195
        },
        "subject": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",
        "aliyunoriginalaccountid": "11xxxxxxxxxxx",
        "source": "arms",
        "type": "aliyun:arms:alarm:claim",
        "aliyunpublishtime": "2022-06-07T09:21:57.362Z",
        "specversion": "1.0",
        "aliyuneventbusname": "armstest",
        "id": "59e174db-f843-473a-9d3e-df3421******",
        "aliyunregionid": "cn-hangzhou",
        "aliyunpublishaddr": "118.31.XX.XX"
    }
  • 告警评论事件
    {
        "datacontenttype": "application/json",
        "aliyunaccountid": "11xxxxxxxxxxx",
        "data": {
            "owner": "xx", //责任人
            "handler": "xx", //处理人
            "data": {  // 告警内容,兼容开源AlertManager事件格式,请参见Prometheus官方文档 https://prometheus.io/docs/alerting/latest/configuration/?spm=a2c4g.11186623.0.0.179176a6M4TIb5#webhook_config
                "alerts": [
                    {
                        "fingerprint": "9b115ab3762a47b51a8efcb516d4aa50",
                        "annotations": {
                            "message": "手动触发的测试告警"
                        },
                        "startsAt": "2022-06-07T09:20:44.000000000Z",
                        "endsAt": "2022-06-07T09:22:00.000000000Z",
                        "labels": {
                            "severity": "error",
                            "regionId": "cn-hangzhou",
                            "_aliyun_arms_denoise_code": "0",
                            "_aliyun_arms_integration_name": "自定义集成",
                            "alertname": "手动触发的告警",
                            "_aliyun_arms_product_type": "CUSTOM",
                            "_aliyun_arms_userid": "11xxxxxxxxxxx",
                            "_aliyun_arms_integration_id": "616",
                            "_aliyun_arms_is_denoise_filtered": "false"
                        },
                        "status": "resolved"
                    }
                ],
                "commonLabels": {
                    "severity": "error",
                    "regionId": "cn-hangzhou",
                    "_aliyun_arms_denoise_code": "0",
                    "_aliyun_arms_integration_name": "自定义集成",
                    "alertname": "手动触发的告警",
                    "_aliyun_arms_product_type": "CUSTOM",
                    "_aliyun_arms_userid": "11xxxxxxxxxxx",
                    "_aliyun_arms_integration_id": "616",
                    "_aliyun_arms_is_denoise_filtered": "false"
                },
                "externalURL": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",
                "groupLabels": {
                    "alertname": "手动触发的告警"
                },
                "receiver": "",
                "level": "P2",
                "dispatchRuleName": "日常运维团队",
                "startTime": "2022-06-07 17:20:44",
                "endTime": "2022-06-07 17:22:00",
                "commonAnnotations": {
                    "message": "手动触发的测试告警"
                },
                "status": "resolved"
            },
            "comment": "解决方案:误报", //评论内容
            "operator": "xx", //操作人
            "timestamp": 1654593720385
        },
        "subject": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",
        "aliyunoriginalaccountid": "11xxxxxxxxxxx",
        "source": "arms",
        "type": "aliyun:arms:alarm:comment",
        "aliyunpublishtime": "2022-06-07T09:22:00.435Z",
        "specversion": "1.0",
        "aliyuneventbusname": "armstest",
        "id": "ef38ca1b-89cb-4c7c-9052-b73e15******",
        "aliyunregionid": "cn-hangzhou",
        "aliyunpublishaddr": "118.31.XX.XX"
    }
  • 告警关闭事件
    {
        "datacontenttype": "application/json",
        "aliyunaccountid": "11xxxxxxxxxxx",
        "data": {
            "owner": "xx", //责任人
            "handler": "xx",  //处理人
            "data": { // 告警内容,兼容开源AlertManager事件格式,请参见Prometheus官方文档 https://prometheus.io/docs/alerting/latest/configuration/?spm=a2c4g.11186623.0.0.179176a6M4TIb5#webhook_config
                "alerts": [
                    {
                        "fingerprint": "9b115ab3762a47b51a8efcb516d4aa50",
                        "annotations": {
                            "message": "手动触发的测试告警"
                        },
                        "startsAt": "2022-06-07T09:20:44.000000000Z",
                        "endsAt": "2022-06-07T09:22:00.000000000Z",
                        "labels": {
                            "severity": "error",
                            "regionId": "cn-hangzhou",
                            "_aliyun_arms_denoise_code": "0",
                            "_aliyun_arms_integration_name": "自定义集成",
                            "alertname": "手动触发的告警",
                            "_aliyun_arms_product_type": "CUSTOM",
                            "_aliyun_arms_userid": "11xxxxxxxxxxx",
                            "_aliyun_arms_integration_id": "616",
                            "_aliyun_arms_is_denoise_filtered": "false"
                        },
                        "status": "resolved"
                    }
                ],
                "commonLabels": {
                    "severity": "error",
                    "regionId": "cn-hangzhou",
                    "_aliyun_arms_denoise_code": "0",
                    "_aliyun_arms_integration_name": "自定义集成",
                    "alertname": "手动触发的告警",
                    "_aliyun_arms_product_type": "CUSTOM",
                    "_aliyun_arms_userid": "11xxxxxxxxxxx",
                    "_aliyun_arms_integration_id": "616",
                    "_aliyun_arms_is_denoise_filtered": "false"
                },
                "externalURL": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",
                "groupLabels": {
                    "alertname": "手动触发的告警"
                },
                "receiver": "",
                "level": "P2",
                "dispatchRuleName": "日常运维团队",
                "startTime": "2022-06-07 17:20:44",
                "endTime": "2022-06-07 17:22:00",
                "commonAnnotations": {
                    "message": "手动触发的测试告警"
                },
                "status": "resolved"
            },
            "solution": "",  //告警解决方案
            "operator": "xx", //操作人
            "timestamp": 1654593720279
        },
        "subject": "https://arms.console.aliyun.com/#/alarm/alert/detail/12345",
        "aliyunoriginalaccountid": "11xxxxxxxxxxx",
        "source": "arms",
        "type": "aliyun:arms:alarm:close",
        "aliyunpublishtime": "2022-06-07T09:22:00.352Z",
        "specversion": "1.0",
        "aliyuneventbusname": "armstest",
        "id": "d997f8c775d4d15b05f3346d5863fdc6******_close",
        "aliyunregionid": "cn-hangzhou",
        "aliyunpublishaddr": "xx.xx.xx.xx"
    }