查询事件报警器报警记录
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/event-records?q=dataUuid=bcb5816592553e04a101e37c69d1837a可查询字段
运行CLI命令行工具,输入QueryEventRecord并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"id": 1.0,
"createTime": 1510669257141.0,
"namespace": "ZStack/PrimaryStorage",
"name": "PrimaryStorageDisconnected",
"emergencyLevel": "Emergent",
"resourceId": "ff1d1d9429da35cfb3d4dfad772d0f3a",
"dataUuid": "64f3d04e7144348db07585dfc9293582",
"accountUuid": "1f2c621ce02d37268da28bb368f6b265",
"subscriptionUuid": "e30c7668d9c13585915da7e6442f6749",
"readStatus": true,
"labels": "{\"Error\":\"No Host state is Enabled, Please check the availability of the host\"}"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.1.0 |
| inventories | List | 详情参考inventories | 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
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| time | long | 时间 | 4.1.0 |
| count | long | 数量 | 4.1.0 |
| id | long | 消息ID | 4.1.0 |
| createTime | long | 创建时间 | 4.1.0 |
| namespace | String | 名字空间 | 4.1.0 |
| name | String | 名称 | 4.1.0 |
| emergencyLevel | String | 报警等级 | 4.1.0 |
| resourceId | String | 资源UUID | 4.1.0 |
| error | String | 错误信息 | 4.1.0 |
| dataUuid | String | 消息UUID | 4.1.0 |
| accountUuid | String | 账户UUID | 4.1.0 |
| subscriptionUuid | String | 事件报警器UUID | 4.1.0 |
| readStatus | Boolean | 已读状态 | 4.1.0 |
| labels | String | 标签列表 | 4.1.0 |
SDK示例
Java SDK
QueryEventRecordAction action = new QueryEventRecordAction();
action.conditions = asList("dataUuid=1e5badf2a4a43bae91b16dbd1aee0c0b");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryEventRecordAction.Result res = action.call();Python SDK
QueryEventRecordAction action = QueryEventRecordAction()
action.conditions = ["dataUuid=60290f65736a317cb52b0721d90ce315"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryEventRecordAction.Result res = action.call()