创建 ZCE-X 报警平台
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' \
http://localhost:8080/zstack/v1/zce-x-plugin/77e1393bf5aa4536a018b4c0c4e29c72/alert-platform参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | ZCE-X 信息的 UUID,唯一标示该资源 | 4.10.6 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源 UUID | 4.10.6 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签 UUID 列表 | 4.10.6 | |
| systemTags (可选) | List | body | 系统标签 | 4.10.6 | |
| userTags (可选) | List | body | 用户标签 | 4.10.6 |
API返回
返回示例
{
"thirdPartyPlatform": {
"uuid": "eec32b6fe11a464790641439f1d7c754",
"name": "xsky-172.20.11.24",
"type": "XSKY",
"url": "http://172.20.11.24:8086/alerts/?token=001adb2ef25e41b7bd01b28651fcfa6a",
"template": "{\n \"product\":\"XSKY\",\n \"service\":\"XSKY\",\n \"message\":\"${resource_type + '[' + resource_name+'] ' + group + ' ' + alert_value}\",\n \"metric\":\"${resource_type + '::' + group}\",\n \"alertLevel\":\"${level == 'info' ? 'Normal' : level == 'warning' ? 'Important' : 'Emergent'}\",\n \"alertTime\":\"${create}\",\n \"dimensions\":\"{'resource_name':'${resource_name}'}\",\n \"dataSource\":\"xsky-172.20.196.185\"\n}",
"description": "desc",
"lastSyncDate": "Feb 18, 2025 7:52:39 AM",
"lastOpDate": "Feb 18, 2025 7:52:39 AM",
"createDate": "Feb 18, 2025 7:52:39 AM"
},
"inventory": {
"zceXUuid": "77e1393bf5aa4536a018b4c0c4e29c72",
"thirdPartyPlatformUuid": "eec32b6fe11a464790641439f1d7c754",
"createDate": "Nov 14, 2017 2:20:57 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 添加是否成功 | 4.10.6 |
| thirdPartyPlatform | ThirdpartyPlatformInventory | 详情参考thirdPartyPlatform | 4.10.6 |
| inventory | ZceXThirdPartyPlatformAlertRefInventory | 详情参考inventory | 4.10.6 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.10.6 |
thirdPartyPlatform
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 平台UUID | 3.10 |
| name | String | 平台名称 | 3.10 |
| type | String | 平台类型 | 3.10 |
| url | String | 平台地址 | 3.10 |
| template | String | 消息转换模板 | 3.10 |
| state | String | 平台状态 | 3.10 |
| description | String | 平台详细描述 | 3.10 |
| lastSyncDate | Timestamp | 上一次同步消息时间 | 3.10 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.10 |
| createDate | Timestamp | 创建时间 | 3.10 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| zceXUuid | String | ZCE-X 资源 UUID | 4.10.6 |
| thirdPartyPlatformUuid | String | 关联的第三方报警平台 UUID | 4.10.6 |
| createDate | Timestamp | 创建时间 | 4.10.6 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.10.0 |
| description | String | 错误的概要描述 | 4.10.0 |
| details | String | 错误的详细信息 | 4.10.0 |
| elaboration | String | 保留字段,默认为null | 4.10.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.10.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.10.0 |
SDK示例
Java SDK
CreateZceXAlertPlatformAction action = new CreateZceXAlertPlatformAction();
action.uuid = "77e1393bf5aa4536a018b4c0c4e29c72";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateZceXAlertPlatformAction.Result res = action.call();Python SDK
CreateZceXAlertPlatformAction action = CreateZceXAlertPlatformAction()
action.uuid = "77e1393bf5aa4536a018b4c0c4e29c72"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateZceXAlertPlatformAction.Result res = action.call()