查询资源报警器报警记录
Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/alarm-records?q=dataUuid=f30e0a92898a3cf39b98c7b20d5d09d7可查询字段
运行CLI命令行工具,输入QueryAlarmRecord并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"id": 1.0,
"createTime": 1510669257141.0,
"accountUuid": "ce8e0ae7bfb93fb09c3339443fb79b5a",
"alarmName": "ZStack Primary Storage Physical Available Capacity Alarm",
"alarmStatus": "Alarm",
"alarmUuid": "701f9528318737bb9db81c4f9b5721a7",
"comparisonOperator": "LessThan",
"context": "{\"PrimaryStorageType\":\"LocalStorage\"}",
"dataUuid": "2e6afdb668443ef9a9a82fcba794d21b",
"emergencyLevel": "Emergent",
"metricName": "AvailablePhysicalCapacityInPercent",
"metricValue": 20.0,
"namespace": "ZStack/PrimaryStorage",
"period": 600.0,
"readStatus": false,
"resourceUuid": "8a596bd1689c3e83a408c2713d99fc6e",
"threshold": 21.0
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.1.0 |
| histograms | List | 4.1.0 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.1.0 |
| description | String | 错误的概要描述 | 4.1.0 |
| details | String | 错误的详细信息 | 4.1.0 |
| elaboration | String | 保留字段,默认为null | 4.1.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.1.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.1.0 |
inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| id | long | 消息ID | 4.1.0 |
| createTime | long | 创建时间 | 4.1.0 |
| accountUuid | String | 账户UUID | 4.1.0 |
| alarmName | String | 报警器名称 | 4.1.0 |
| alarmStatus | String | 报警状态 | 4.1.0 |
| alarmUuid | String | 报警器UUID | 4.1.0 |
| comparisonOperator | String | 阈值比较符 | 4.1.0 |
| context | String | 内容 | 4.1.0 |
| dataUuid | String | 消息UUID | 4.1.0 |
| emergencyLevel | String | 报警等级 | 4.1.0 |
| labels | String | 标签列表 | 4.1.0 |
| metricName | String | 监控项名称 | 4.1.0 |
| metricValue | Double | 监控项值 | 4.1.0 |
| namespace | String | 名字空间 | 4.1.0 |
| period | int | 阈值持续时间 | 4.1.0 |
| readStatus | Boolean | 已读状态 | 4.1.0 |
| resourceUuid | String | 资源UUID | 4.1.0 |
| threshold | Double | 阈值 | 4.1.0 |
SDK示例
Java SDK
QueryAlarmRecordAction action = new QueryAlarmRecordAction();
action.conditions = asList("dataUuid=8860f33a964e3141aee2c3ffde2918b7");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAlarmRecordAction.Result res = action.call();Python SDK
QueryAlarmRecordAction action = QueryAlarmRecordAction()
action.conditions = ["dataUuid=a83224ddc145340b9b7b12170ba614ba"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAlarmRecordAction.Result res = action.call()