告警事件:告警歷史查詢
更新時間 2024-09-25 16:20:54
最近更新時間: 2024-09-25 16:20:54
分享文章
告警事件
告警事件:告警歷史查詢
接口功能介紹
查詢告警歷史, 返回結果按告警歷史的觸發時間(createTime)降序排列。
接口約束
regionID(資源池)存在,searchKey(搜索關鍵詞)滿足參數說明范圍。
URI
POST /v4/monitor/query-alert-history
路徑參數
無
Query參數
無
請求參數
請求頭header參數
無
請求體body參數
| 參數 | 是否必填 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|---|
| regionID | 是 | String | ctyun資源池ID | 81f7728662dd11ec810800155d307d5b | |
| status | 是 | Integer | 本參數表示狀態。取值范圍:0:正在告警。1:告警歷史。根據以上范圍取值。 | 0 | |
| resourceGroupID | 否 | String | 資源分組ID。 | 3c9362cc-bd95-55c6-8b5f-66b4b712dcfb | |
| searchKey | 否 | String | 本參數表示搜索關鍵詞。取值范圍:alarmRuleID:告警規則ID,精確查詢。name:告警規則名稱,模糊查詢。根據以上范圍取值。 | name | |
| searchValue | 否 | String | 配合searchKey使用,對應的值 | test | |
| service | 否 | Array of Strings | 本參數表示告警服務。取值范圍:ecs:云主機。evs:云硬盤。pms:物理機。...詳見“告警規則:獲取告警服務列表”接口返回。 | ['ecs', 'evs'] | |
| startTime | 否 | Integer | 查詢狀態為告警歷史(參數status=1)時的起始時間戳, 默認值:24小時前時間戳,startTime和endTime需同時傳或同時不傳 | 1667815639 | |
| endTime | 否 | Integer | 查詢狀態為告警歷史(參數status=1)時的結束時間戳,默認值:當前時間戳, 配合startTime一起使用 | 1667817639 | |
| pageNo | 否 | Integer | 頁碼,默認為1 | 1 | |
| page | 否 | Integer | 頁碼,默認為1,建議使用pageNo,該參數后續會下線 | 1 | |
| pageSize | 否 | Integer | 頁大小,默認為10 | 10 |
響應參數
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| statusCode | Integer | 返回狀態碼(800為成功,900為失敗),默認值:800 | 800 | |
| errorCode | String | 失敗時的錯誤代碼,參見公共錯誤碼說明 | ||
| message | String | 失敗時的錯誤描述,一般為英文描述 | Success | |
| msgDesc | String | 失敗時的錯誤描述,一般為中文描述 | 成功 | |
| error | String | 錯誤碼,請求成功時,不返回該字段 | Openapi.Parameter.Error | |
| returnObj | Object | 返回對象 | returnObj |
表 returnObj
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| issues | Array of Objects | 告警事件列表 | issue | |
| totalCount | Integer | 總記錄數 | 20 | |
| currentCount | Integer | 當前頁記錄數 | 5 | |
| page | Integer | 頁碼 | 1 | |
| pageSize | Integer | 頁大小 | 20 | |
| totalPage | Integer | 總頁數 | 3 |
表 issue
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| regionID | String | ctyun資源池ID | 81f7728662dd11ec810800155d307d5b | |
| issueID | String | 告警歷史ID | 65b08a5848091836a6f2afd8 | |
| alarmRuleID | String | 告警規則ID | f704a846-7194-5e57-9859-3b0e91f986f4 | |
| name | String | 告警規則名稱 | testname | |
| status | Integer | 本參數表示告警狀態。取值范圍:0:正在告警。1:告警歷史。根據以上范圍取值。 | 1 | |
| dataStatus | Integer | 本參數表示正在告警下的狀態細分。取值范圍:0:有數據。1:無數據。根據以上范圍取值。 | 0 | |
| expiredStatus | Integer | 本參數表示告警歷史下的狀態細分。取值范圍:0:正常歷史告警。1:已失效(告警規則已刪除或已禁用)根據以上范圍取值。 | 1 | |
| alarmType | String | 本參數表示告警類型。取值范圍:series:指標類型。event:事件類型。根據以上范圍取值。 | series | |
| service | String | 服務 | ecs | |
| dimension | String | 維度 | ecs | |
| notifyType | Array of Strings | 本參數表示告警接收策略。取值范圍:email:郵件告警。sms:短信告警。根據以上范圍取值。 | ['email'] | |
| duration | Integer | 持續時間,單位秒 | 43200 | |
| contactGroupList | Array of Objects | 所屬組信息 | contactGroup | |
| createTime | Integer | 觸發時間的時間戳 | 1698823059 | |
| updateTime | Integer | 更新時間的時間戳 | 1698823059 | |
| resGroupID | String | 資源分組ID | 41f64827f25f468595ffa3a5deb5d777 | |
| resources | Array of Objects | 告警資源 | resource |
表 contactGroup
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| contactGroupID | String | 聯系人組ID | b6fb5df3-gasd-5bde-989c-df0819c687d0 | |
| name | String | 聯系人組名稱 | testgroup |
表 resource
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| name | String | 監控指標 | cpu_util | |
| value | String | 監控指標中文描述 | cpu使用率 |
請求示例
請求url
/v4/monitor/query-alert-history
請求頭header
無
請求體body
{
"regionID":"81f7728662dd11ec810800155d307d5b",
"status":1,
"service":[
"evs",
"ecs"
],
"searchKey": "alarmRuleID",
"searchValue": "41f64827f25f468595ffa3a5deb5d666",
"endTime":1698982651,
"startTime":1698896251,
"pageSize":10,
"pageNo":1
}
響應示例
{
"statusCode":800,
"returnObj":{
"issues":[
{
"regionID":"81f7728662dd11ec810800155d307d5b",
"issueID":"65b08a5848091836a6f2afd8",
"alarmRuleID":"f704a846-7194-5e57-9859-3b0e91f986f4",
"name":"vpn-gateway-8c38-sslsssl",
"status":1,
"dataStatus":0,
"expiredStatus":0,
"alarmType": "series",
"service":"ipsec_vpn",
"dimension":"ipsec_vpn_gw_stats",
"notifyType":[
"email"
],
"createTime":1706068568,
"updateTime":1706079960,
"duration":11392,
"contactGroupList":[
{
"contactGroupID":"6ddf1d70-4107-5a35-89f6-58d920450e2f",
"name":"導入導出"
}
],
"resGroupID":"",
"resources":[
{
"resource":[
{
"name":"task_id",
"value":"8f52276a-1ee3-45f5-9a33-db0a9b7f65e0"
},
{
"name":"instancename",
"value":"new創建"
}
]
}
]
},
{
"regionID":"81f7728662dd11ec810800155d307d5b",
"issueID":"65b089e248091836a6f2afcc",
"alarmRuleID":"d8355ff0-331a-53e2-b62a-7ef5fee71df6",
"name":"123123",
"status":1,
"dataStatus":0,
"expiredStatus":0,
"alarmType": "series",
"service":"ipsec_vpn",
"dimension":"ipsec_vpn_gw_stats",
"notifyType":[
"email"
],
"createTime":1706068450,
"updateTime":1706079960,
"duration":11510,
"contactGroupList":[
{
"contactGroupID":"ccc9ff48-2c90-5011-9c24-3d9c8bbf3e29",
"name":"lh組"
}
],
"resGroupID":"",
"resources":[
{
"resource":[
{
"name":"task_id",
"value":"8f52276a-1ee3-45f5-9a33-db0a9b7f65e0"
},
{
"name":"instancename",
"value":"new創建"
}
]
}
]
}
],
"page":1,
"pageSize":2,
"totalCount":50,
"currentCount":2,
"totalPage":15
},
"errorCode":"",
"message":"Success",
"msgDesc":"成功"
}
狀態碼
| 狀態碼 | 描述 |
|---|---|
| 200 | 請求成功 |
錯誤碼
| errorCode | 描述 |
|---|---|
| 其他 | 參見公共錯誤碼說明 |