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"
    }