自定義監控告警規則:查詢列表
更新時間 2024-09-25 16:20:51
最近更新時間: 2024-09-25 16:20:51
分享文章
告警規則
自定義監控告警規則:查詢列表
接口功能介紹
根據篩選項查詢自定義監控告警規則列表。
接口約束
regionID(資源池)存在。
URI
GET /v4/monitor/query-custom-alarm-rules
路徑參數
無
Query參數
| 參數 | 是否必填 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|---|
| regionID | 是 | String | ctyun資源池ID | 81f7728662dd11ec810800155d307d5b | |
| status | 否 | Integer | 本參數表示告警規則啟用狀態。取值范圍:0:啟用。1:停用。根據以上范圍取值。 | 0 | |
| alarmStatus | 否 | Integer | 本參數表示告警規則告警狀態。取值范圍:0:正常。1:正在告警。根據以上范圍取值。 | 0 | |
| sort | 否 | String | 本參數表示排序條件,-表示降序。支持的排序字段:updateTime:更新時間。根據以上范圍取值。 | -updateTime | |
| name | 否 | String | 規則名稱 | test | |
| pageNo | 否 | Integer | 頁碼,默認為1 | 1 | |
| pageSize | 否 | Integer | 頁大小,默認為20 | 10 |
請求參數
請求頭header參數
無
請求體body參數
無
響應參數
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| statusCode | Integer | 返回狀態碼(800為成功,900為失敗),默認值:800 | 800 | |
| errorCode | String | 失敗時的錯誤代碼,參見公共錯誤碼說明 | ||
| message | String | 失敗時的錯誤描述,一般為英文描述 | Success | |
| msgDesc | String | 失敗時的錯誤描述,一般為中文描述 | 成功 | |
| error | String | 錯誤碼,請求成功時,不返回該字段 | Openapi.Parameter.Error | |
| returnObj | Object | 返回對象 | returnObj |
表 returnObj
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| alarmRules | Array of Objects | 告警規則 | alarmRule | |
| totalCount | Integer | 總記錄數 | 20 | |
| currentCount | Integer | 當前頁記錄數 | 10 | |
| totalPage | Integer | 總頁數 | 2 |
表 alarmRule
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| regionID | String | ctyun資源池ID | 81f7728662dd11ec810800155d307d5b | |
| alarmRuleID | String | 告警規則ID | 3dbd23b2-74e2-53f8-869c-6fe6b07b9dba | |
| name | String | 規則名 | 告警規則lyc123 | |
| desc | String | 描述 | test | |
| repeatTimes | Integer | 重復告警通知次數 | 1 | |
| silenceTime | Integer | 靜默時間,單位:秒 | 300 | |
| recoverNotify | Integer | 本參數表示恢復是否通知。默認值0。取值范圍:0:否。1:是。根據以上范圍取值。 | 0 | |
| notifyType | Array of Strings | 告警接收策略 | ['email', 'sms'] | |
| contactGroupList | Array of Strings | 告警聯系人組 | ['000f0322-1f4d-8cc8-bb2e-1c30fb751ccc'] | |
| notifyWeekdays | Array of Integers | 通知周期 | [0,1,2,3] | |
| notifyStart | String | 通知起始時段 | 00:00:00 | |
| notifyEnd | String | 通知結束時段 | 23:59:59 | |
| webhookUrl | Array of Strings | 否 | ['//www.daliqc.cn/'] | 告警狀態變更webhook推送地址 |
| evaluationCount | Integer | 持續周期數 | 2 | |
| customItemID | String | 自定義監控指標 | ITEM63cb8954325480a3202307071801 | |
| fun | String | 本參數表示告警采用算法。取值范圍:last:原始值算法。avg:平均值算法。max:最大值算法。min:最小值算法。根據以上范圍取值。 | avg | |
| operator | String | 本參數表示比較符。默認值le。取值范圍:eq:等于。gt:大于。ge:大于等于。lt:小于。le:小于等于。根據以上范圍取值。 | eq | |
| value | String | 告警閾值,可以是整數、小數或百分數格式字符串 | 0 | |
| period | String | 本參數表示算法統計周期。默認值5m。參數fun為last時不可傳。參數fun為avg、max、min均需填此參數。本參數格式為“數字+單位”。單位取值范圍:m:分鐘。h:小時。d:天。根據以上范圍取值。 | 5m | |
| dimensions | Array of Objects | 否 | 自定義監控項維度 | |
| status | Integer | 本參數表示告警規則啟用狀態。取值范圍:0:啟用。1:停用。根據以上范圍取值。 | 0 | |
| alarmStatus | Integer | 本參數表示告警規則告警狀態。取值范圍:0:正常。1:正在告警。根據以上范圍取值。 | 0 | |
| createTime | Integer | 創建時間 | 1689580180000 | |
| updateTime | Integer | 更新時間 | 1689580180000 |
表 dimValue
| 參數 | 參數類型 | 說明 | 示例 | 下級對象 |
|---|---|---|---|---|
| name | String | 是 | host | 維度名稱 |
| value | Array of Strings | 是 | ['自定義值1','自定義值2'] | 維度值 |
請求示例
請求url
/v4/monitor/query-custom-alarm-rules?regionID=81f7728662dd11ec810800155d307d5b&status=1&page=1&pageSize=1
請求頭header
無
請求體body
無
響應示例
{
"statusCode": 800,
"returnObj": {
"alarmRules": [
{
"alarmRuleID": "3dbd23b2-74e2-53f8-869c-6fe6b07b9dba",
"regionID": "81f7728662dd11ec810800155d307d5b",
"name": "自定義告警規則測試",
"desc": "test",
"repeatTimes": 0,
"silenceTime": 300,
"recoverNotify": 0,
"notifyType": ["email"],
"contactGroupList": [],
"notifyWeekdays": [0, 1, 2, 3, 4, 5, 6],
"notifyStart": "00:00:00",
"notifyEnd": "23:59:59",
"webhookUrl": ["//www.daliqc.cn/"],
"evaluationCount": 5,
"customItemID": "ITEM63cb8954325480a3202307071801",
"fun": "avg",
"operator": "ge",
"value": "0",
"period": "5m",
"dimensions": [
{
"name" : "dim1",
"value": "value1"
}
],
"createTime":1689580180000,
"updateTime":1689580180000
}
],
"totalCount": 2,
"currentCount": 1,
"totalPage": 2
},
"errorCode": "",
"message": "Success",
"msgDesc":"成功"
}
狀態碼
| 狀態碼 | 描述 |
|---|---|
| 200 | 表示請求成功 |
錯誤碼
| 錯誤碼 | 描述 |
|---|---|
| 其他 | 參見公共錯誤碼說明 |