全部產品
Search
文件中心

Application Real-Time Monitoring Service:將警示事件發送到EventBridge

更新時間:Jul 06, 2024

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