告警事件:告警历史查询
更新时间 2024-04-07 10:40:23
最近更新时间: 2024-04-07 10:40:23
接口功能介绍
查询告警历史。
接口功能介绍
查询告警历史, 返回结果按告警历史的触发时间(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 | 描述 |
|---|---|
| 其他 | 参见公共错误码说明 |