仪表盘接口
仪表盘接口
创建仪表盘
请求结构体
Method:POST
Url:/csm/api/v1/dashboard/products/{product}/dashboards
请求参数:
名称 | 类型 | 描述 | 是否必须 | 参数位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
paramMap | DataConfiguration | 是 | RequestBody参数 |
请求示例:
POST /csm/api/v1/dashboard/products/453bf9588c9e488f9ba2c984129090dc/dashboards
{
"userId": "453bf9588c9e488f9ba2c984129090dc",
"title": "LupinsDashboard",
"configure": {
"tabs": [
{
"name": "",
"widgets": [
],
"namespace": [
],
"dimensions": [
],
"metric": [
]
}
]
},
"type": "common"
}
响应示例:
{
"success": true,
"data": {
"name": "_54387"
},
"message": "ok",
"traceInfo": null,
"code": 200
}
删除仪表盘
请求结构体:
Method:Delete
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}
请求参数:
名称 | 类型 | 描述 | 是否必须 | 参数位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id(非显示名称) | 是 | URL参数 |
请求示例:
Delete /csm/api/v1/dashboard/products/453bf9588c9e488f9ba2c984129090dc/dashboards/_50971
响应示例:
{
"success": true,
"data": null,
"message": "ok",
"traceInfo": null,
"code": 200
}
修改仪表盘
请求结构体:
Method:Put
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}
请求参数:
名称 | 类型 | 描述 | 是否必须 | 参数位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id(非显示名称) | 是 | URL参数 |
请求示例:
Put /csm/api/v1/dashboard/products/453bf9588c9e488f9ba2c984129090dc/dashboards/_51008
{
"title": "LupinsDashboardxx",
"dashboardName": "_51008",
"configure": {
"tabs": [
{
"dimensions": [
],
"metric": [
],
"name": "",
"namespace": [
],
"widgets": [
]
}
]
},
"userId": "453bf9588c9e488f9ba2c984129090dc"
}
响应示例:
{
"success": true,
"data": "_54440",
"message": "ok",
"traceInfo": null,
"code": 200
}
查询仪表盘:
请求结构体:
Method:Get
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}
请求参数:
名称 | 类型 | 描述 | 是否必须 | 参数位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id(非显示名称) | 是 | URL参数 |
请求示例:
Get /csm/api/v1/dashboard/products/453bf9588c9e488f9ba2c984129090dc/dashboards/_51008
响应示例:
{
"success": true,
"data": {
"product": "453bf9588c9e488f9ba2c984129090dc",
"lastUpdate": "2022-03-15T11:57:26.000+0000",
"name": "_51008",
"updator": "root:dasdsad",
"pid": 0,
"configure": "{\"tabs\":[{\"dimensions\":[],\"metric\":[],\"name\":\"\",\"namespace\":[],\"widgets\":[[{\"name\":\"_51008_51009\"}]]}]}",
"title": "LupinsDashboardxx",
"type": "common"
},
"message": "ok",
"traceInfo": null,
"code": 200
}
复制仪表盘
请求结构体:
Method:POST
Url: /csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}/duplicate
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id | 是 | URL参数 |
请求示例:
Post /csm/api/v1/dashboard/products/453************************/dashboards/_51038/duplicate
{}
响应示例:
{
"success": true,
"data": "_54581",
"message": "ok",
"traceInfo": null,
"code": 200
}
DataConfiguration字段说明:
名称 | 类型 | 描述 | 是否必须 |
---|---|---|---|
userId | String | 用户id | 是 |
title | String | 仪表盘名称 | 是 |
configure | String | 仪表盘配置字段 | 是 |
type | String | 仪表盘类型, | 是 |
仪表盘的configure字段说明:
名称 | 解释说明 | 是否必须 |
---|---|---|
dimensions | 维度信息 | 是,但为空 |
metric | 指标信息 | 是,但为空 |
name | 组件id | 是,但为空 |
widgets | 组件集合 | 是,可为空 |
组件接口:
创建组件
请求结构体:
Method:Post
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}/widgets
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘名字 | 是 | URL参数 |
请求示例:
Post /csm/api/v1/dashboard/products/453bf9588c9e488f9ba2c984129090dc/dashboards/_51008/widgets
{}
响应示例:
{
"success": true,
"data": "_54440_54598",
"message": "ok",
"traceInfo": null,
"code": 200
}
删除组件:
请求结构体:
Method: Delete
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}/widgets/{widgetName}
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id | 是 | URL参数 |
widgetName | String | 组件id | 是 | URL参数 |
请求示例:
Delete /csm/api/v1/dashboard/products/453bf9588c9e488f9ba2c984129090dc/dashboards/_51008/widgets/_51008_51010
响应示例:
{
"success": true,
"data": null
"message": "ok",
"traceInfo": null,
"code": 200
}
修改组件:
请求结构体:
Method:Put
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}/widgets/{widgetName}
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id | 是 | URL参数 |
widgetName | String | 组件id | 是 | URL参数 |
bodyParams | Map<String, Object> | 请求体 | 是 | requestBody |
请求示例:
Put /csm/api/v1/dashboard/products/453bf9588c9e488f9ba2c984129090dc/dashboards/_51008/widgets/_51008_51011
requestbody:
{
"title": "testApi",
"type": "trend",
"configure": {
"data": [
{
"metric": [
{
"name": "vCPUUsagePercent",
"unit": "%",
"alias": "CPU使用率",
"contrast": [
],
"timeContrast": [
],
"statistics": "avg"
}
],
"monitorObject": [
{
"instanceName": "instance-mmd6nizg",
"id": "i-WAMdDHZ0"
}
],
"scope": "BCE_BCC",
"subService": "linux",
"region": "bj",
"scopeValue": {
"name": "BCC",
"value": "BCE_BCC",
"hasChildren": false
},
"resourceType": "Instance",
"namespace": [
{
"namespaceType": "instance",
"transfer": "",
"filter": "",
"name": "i-WAMdDHZ0___bj.BCE_BCC.453bf9588c9e488f9ba2c984129090dc",
"instanceName": "instance-mmd6nizg",
"region": "bj",
"bcmService": "BCE_BCC",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
]
}
],
"product": "453bf9588c9e488f9ba2c984129090dc"
}
],
"style": {
"displayType": "line",
"nullPointMode": "zero",
"threshold": 0,
"decimals": 2,
"isEdit": true,
"unit": "%"
},
"title": "testApi",
"timeRange": {
"timeType": "dashboard",
"unit": "minutes",
"number": 1,
"relative": "today()"
},
"time": ""
},
"dashboardName": "_51008",
"widgetName": "_51008_51011",
"lastUpdate": "2022-03-15T12:36:12Z",
"userId": "453bf9588c9e488f9ba2c984129090dc"
}
响应示例:
{
"success": true,
"data": _51008_51011
"message": "ok",
"traceInfo": null,
"code": 200
}
查找组件:
请求结构体:
Method:Get
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}/widgets/{widgetName}
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id | 是 | URL参数 |
widgetName | String | 组件id | 是 | URL参数 |
请求示例:
Get /csm/api/v1/dashboard/products/a0d04d7c202140cb80155ff7b6752ce4/dashboards/_50367/widgets/_50367_50368
响应示例:
{
"success": true,
"data": {
"id": 54434,
"pid": 54433,
"product": "453bf9588c9e488f9ba2c984129090dc",
"name": "_54433_54434",
"title": "bcc-test",
"configure": "{\"data\":[{\"metric\":[{\"alias\":\"CPU使用率\",\"contrast\":[],\"name\":\"CPUUsagePercent\",\"statistics\":\"avg\",\"timeContrast\":[],\"unit\":\"%\"}],\"monitorObject\":[{\"id\":\"i-SyWlclXE\",\"instanceName\":\"instance-4q17zwof \"}],\"monitorType\":\"scope\",\"namespace\":[{\"bcmService\":\"BCE_BCC\",\"filter\":\"\",\"instanceName\":\"instance-4q17zwof \",\"name\":\"i-SyWlclXE___bj.BCE_BCC.453bf9588c9e488f9ba2c984129090dc\",\"namespaceType\":\"instance\",\"region\":\"bj\",\"subService\":[{\"name\":\"serviceType\",\"value\":\"linux\"}],\"transfer\":\"\"}],\"product\":\"453bf9588c9e488f9ba2c984129090dc\",\"region\":\"bj\",\"resourceType\":\"Instance\",\"scope\":\"BCE_BCC\",\"scopeValue\":{\"hasChildren\":false,\"name\":\"BCC\",\"value\":\"BCE_BCC\"},\"subService\":\"linux\"}],\"monitorType\":\"scope\",\"style\":{\"decimals\":2,\"displayType\":\"line\",\"isEdit\":true,\"nullPointMode\":\"zero\",\"threshold\":0,\"unit\":\"%\"},\"time\":\"\",\"timeRange\":{\"number\":1,\"relative\":\"today()\",\"timeType\":\"dashboard\",\"unit\":\"minutes\"},\"title\":\"bcc-test\"}",
"lastUpdate": "2023-12-06T08:36:35.000+0000",
"updator": "root:dasdsad",
"type": "trend",
"overviewOrder": 0,
"isFavorite": false
},
"message": "ok",
"traceInfo": null,
"code": 200
}
复制组件:
请求结构体:
Method:Post
Url:/csm/api/v1/dashboard/products/{product}/dashboards/{dashboardName}/widgets/{widgetName}/duplicate
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
Product | String | 用户id | 是 | URL参数 |
dashboardName | String | 仪表盘id | 是 | URL参数 |
widgetName | String | 组件id | 是 | URL参数 |
请求示例:
Post /csm/api/v1/dashboard/products/a0d04d7c202140cb80155ff7b6752ce4/dashboards/_50367/widgets/_50367_50368/duplicate
{}
响应示例:
{
"success": true,
"data": _51008_51011
"message": "ok",
"traceInfo": null,
"code": 200
}
bodyParams中各个字段的含义:
名称 | 类型 | 描述 |
---|---|---|
titile | String | 图表名称 |
type | String | 图表类型 |
configure | Object | 配置信息 |
dashboardName | String | 仪表盘id |
widgetName | String | 组件id |
userId | String | 用户id |
Configure的特殊说明:
名称 | 类型 | 描述 |
---|---|---|
metric | Object | 存储指标信息 |
monitorObject | List | 存储实例的实例名称和短id |
monitorType | String | 监控对象类型 |
scope | String | 云产品名称 |
subService | String | 操作系统名称 |
region | String | 地域 |
scopeValue | Object | 存储云产品名称以及是否是具有子类型的云产品 |
resourceType | String | 资源类型 |
namespace | Object | 实例信息 |
product | String | 用户id |
style | String | 曲线风格 |
title | String | 图表名称 |
timeRange | Object | 存储时间信息 |
metric解释说明:
名称 | 类型 | 说明 |
---|---|---|
name | String | 指标英文名 |
unit | String | 单位名称 |
alias | String | 指标中文名 |
contrast | List | |
timeContrast | List | |
statistics | String | 数据的统计方式 |
scopeValue解释说明:
名称 | 类型 | 说明 |
---|---|---|
name | String | 云产品名称 |
value | String | 云产品名称 |
hasChildren | String | 是否具有子类型 |
namespace解释说明:
名称 | 类型 | 说明 |
---|---|---|
namespaceType | String | 实例类型 |
transfer | String | 可为空 |
filter | String | 可为空 |
name | String | 由短id,region,scope和用户id拼接 |
instanceName | String | 实例名称 |
region | String | 地域 |
bcmService | String | 云产品名称 |
subService | List | 操作系统类型 |
monitorObject解释说明
名称 | 类型 | 说明 |
---|---|---|
instanceName | String | 监控对象名称 |
id | String | 监控对象ID |
查询数据接口:
查询表格数据接口:
查询指标单维度数据:
请求结构体:
Method: Post
Url: /csm/api/v1/dashboard/metric/report
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例:
Post /csm/api/v1/dashboard/metric/report
{
"data": [
{
"metric": [
{
"alias": "CPU空闲率",
"cycle": 30,
"displayName": "cpu",
"name": "CpuIdlePercent",
"statistics": "avg",
"unit": "%"
}
],
"monitorObject": [
{
"id": "i-isvkUW76",
"instanceName": "instance-xcy9049y "
}
],
"monitorType": "scope",
"namespace": [
{
"bcmService": "BCE_BCC",
"instanceName": "instance-xcy9049y ",
"name": "i-isvkUW76___bj.BCE_BCC.a0d04d7c202140cb80155ff7b6752ce4",
"namespaceType": "app",
"region": "bj",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
],
"transfer": ""
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"region": "bj",
"scope": "BCE_BCC",
"scopeValue": {
"name": "BCC",
"value": "BCE_BCC"
},
"subService": "linux"
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例:
{
"success": true,
"data": [
{
"name": "namespace",
"alias": "instance-xcy9049y ",
"value": "i-isvkUW76___bj.BCE_BCC.a0d04d7c202140cb80155ff7b6752ce4",
"metrics": {
"cpu": 99.600074827175
},
"children": []
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询指标多维度数据:
请求结构体:
Method: Post
Url: /csm/api/v1/dashboard/metric/report
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例:
Post /csm/api/v1/dashboard/metric/report
{
"data": [
{
"region": "bj",
"subService": "linux",
"namespace": [
{
"namespaceType": "app",
"transfer": "",
"filter": "",
"name": "41b372b8-3acc-423c-a6b0-af5c69fd1c41___bj.BCE_BEC.a0d04d7c202140cb80155ff7b6752ce4",
"instanceName": "prod.nmp.nn.yd1 ",
"region": "bj",
"bcmService": "BCE_BEC",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
]
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"monitorObject": [
{
"instanceName": "prod.nmp.nn.yd1",
"id": "41b372b8-3acc-423c-a6b0-af5c69fd1c41"
}
],
"scope": "BCE_BEC",
"scopeValue": {
"name": "BEC",
"value": "BCE_BEC",
"hasChildren": false
},
"metric": [
{
"displayName": "",
"name": "vNicInBytes",
"alias": "网卡输入流量",
"unit": "Bytes",
"contrast": [
],
"timeContrast": [
],
"statistics": "avg",
"cycle": 60,
"dimensions": [
"eth1",
"eth0"
],
"metricDimensions": [
{
"name": "nicName",
"values": [
"eth1",
"eth0"
]
}
]
}
]
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例:
{
"success": true,
"data": [
{
"name": "namespace",
"alias": "prod.nmp.nn.yd1 ",
"value": "vm-qngdck2p-cn-nanning-cm-mqckb___bj.BCE_BEC.a0d04d7c202140cb80155ff7b6752ce4",
"metrics": {
"网卡输入流量/nicName:eth0": 280.3833333333,
"网卡输入流量/nicName:eth1": 48189.416666662495
},
"children": []
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询趋势图数据接口:
请求指标单单维度数据:
请求结构体:
Method: Post
Url: /csm/api/v1/dashboard/metric/trend
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例:
Post /csm/api/v1/dashboard/metric/trend
{
"data": [
{
"metric": [
{
"alias": "CPU空闲率",
"cycle": 30,
"displayName": "cpu",
"name": "CpuIdlePercent",
"statistics": "avg",
"unit": "%"
}
],
"monitorObject": [
{
"id": "i-isvkUW76",
"instanceName": "instance-xcy9049y "
}
],
"monitorType": "scope",
"namespace": [
{
"bcmService": "BCE_BCC",
"instanceName": "instance-xcy9049y ",
"name": "i-isvkUW76___bj.BCE_BCC.a0d04d7c202140cb80155ff7b6752ce4",
"namespaceType": "app",
"region": "bj",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
],
"transfer": ""
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"region": "bj",
"scope": "BCE_BCC",
"scopeValue": {
"name": "BCC",
"value": "BCE_BCC"
},
"subService": "linux"
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例:
{
"success": true,
"data": [
{
"product": null,
"data": [
[
1701997859000,
99.53344561470001
],
[
1701997919000,
99.66670403965
]
],
"legend": null,
"numerator": 1,
"denominator": 1,
"metricUnit": "%",
"metricType": "",
"metricUnitTransformation": "",
"scope": "ignore",
"metric": "cpu",
"name": "instance-xcy9049y ",
"transPolicy": "",
"time": null,
"dimensions": "",
"statistics": null,
"namespace": "i-isvkUW76___bj.BCE_BCC.a0d04d7c202140cb80155ff7b6752ce4",
"hostName": null,
"intranetIp": null
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询指标多维度数据:
请求结构体:
Method: Post
Url: /csm/api/v1/dashboard/metric/trend
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例:
{
"data": [
{
"region": "bj",
"subService": "linux",
"namespace": [
{
"namespaceType": "app",
"transfer": "",
"filter": "",
"name": "41b372b8-3acc-423c-a6b0-af5c69fd1c41___bj.BCE_BEC.a0d04d7c202140cb80155ff7b6752ce4",
"instanceName": "prod.nmp.nn.yd1 ",
"region": "bj",
"bcmService": "BCE_BEC",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
]
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"monitorObject": [
{
"instanceName": "prod.nmp.nn.yd1",
"id": "41b372b8-3acc-423c-a6b0-af5c69fd1c41"
}
],
"scope": "BCE_BEC",
"scopeValue": {
"name": "BEC",
"value": "BCE_BEC",
"hasChildren": false
},
"metric": [
{
"displayName": "",
"name": "vNicInBytes",
"alias": "网卡输入流量",
"unit": "Bytes",
"contrast": [
],
"timeContrast": [
],
"statistics": "avg",
"cycle": 60,
"dimensions": [
"eth1",
"eth0"
],
"metricDimensions": [
{
"name": "nicName",
"values": [
"eth1",
"eth0"
]
}
]
}
]
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例:
{
"success": true,
"data": [
{
"product": null,
"data": [
[
1701997859000,
281.8333333333
],
[
1701997919000,
278.93333333329997
]
],
"legend": null,
"numerator": 1,
"denominator": 1,
"metricUnit": "Bytes",
"metricType": "",
"metricUnitTransformation": "",
"scope": "ignore",
"metric": "网卡输入流量",
"name": "prod.nmp.nn.yd1 ",
"transPolicy": "",
"time": null,
"dimensions": "nicName=eth0",
"statistics": null,
"namespace": "vm-qngdck2p-cn-nanning-cm-mqckb___bj.BCE_BEC.a0d04d7c202140cb80155ff7b6752ce4",
"hostName": null,
"intranetIp": null
},
{
"product": null,
"data": [
[
1701997859000,
48307.549999995
],
[
1701997919000,
48071.28333333
]
],
"legend": null,
"numerator": 1,
"denominator": 1,
"metricUnit": "Bytes",
"metricType": "",
"metricUnitTransformation": "",
"scope": "ignore",
"metric": "网卡输入流量",
"name": "prod.nmp.nn.yd1 ",
"transPolicy": "",
"time": null,
"dimensions": "nicName=eth1",
"statistics": null,
"namespace": "vm-qngdck2p-cn-nanning-cm-mqckb___bj.BCE_BEC.a0d04d7c202140cb80155ff7b6752ce4",
"hostName": null,
"intranetIp": null
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询仪表图数据接口:
查询指标单维度数据
请求结构体:
Method: Post
Url: /csm/api/v1/dashboard/metric/gaugechart
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例:
Post /csm/api/v1/dashboard/metric/gaugechart
{
"data": [
{
"metric": [
{
"alias": "CPU空闲率",
"cycle": 30,
"displayName": "cpu",
"name": "CpuIdlePercent",
"statistics": "avg",
"unit": "%"
}
],
"monitorObject": [
{
"id": "i-isvkUW76",
"instanceName": "instance-xcy9049y "
}
],
"monitorType": "scope",
"namespace": [
{
"bcmService": "BCE_BCC",
"instanceName": "instance-xcy9049y ",
"name": "i-isvkUW76___bj.BCE_BCC.a0d04d7c202140cb80155ff7b6752ce4",
"namespaceType": "app",
"region": "bj",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
],
"transfer": ""
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"region": "bj",
"scope": "BCE_BCC",
"scopeValue": {
"name": "BCC",
"value": "BCE_BCC"
},
"subService": "linux"
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例:
{
"success": true,
"data": [
{
"name": "CPU空闲率",
"data": [
[
0,
99.600074827175
]
],
"displayName": "CPU空闲率",
"instanceName": "instance-xcy9049y ",
"unit": "%",
"metricDimension": null,
"decimals": null
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询指标多维度数据
请求结构体
Method: Post
Url: /csm/api/v1/dashboard/metric/gaugechart
请求参数
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例
Post /csm/api/v1/dashboard/metric/gaugechart
{
"data": [
{
"region": "bj",
"subService": "linux",
"namespace": [
{
"namespaceType": "app",
"transfer": "",
"filter": "",
"name": "41b372b8-3acc-423c-a6b0-af5c69fd1c41___bj.BCE_BEC.a0d04d7c202140cb80155ff7b6752ce4",
"instanceName": "prod.nmp.nn.yd1 ",
"region": "bj",
"bcmService": "BCE_BEC",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
]
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"monitorObject": [
{
"instanceName": "prod.nmp.nn.yd1",
"id": "41b372b8-3acc-423c-a6b0-af5c69fd1c41"
}
],
"scope": "BCE_BEC",
"scopeValue": {
"name": "BEC",
"value": "BCE_BEC",
"hasChildren": false
},
"metric": [
{
"displayName": "",
"name": "vNicInBytes",
"alias": "网卡输入流量",
"unit": "Bytes",
"contrast": [
],
"timeContrast": [
],
"statistics": "avg",
"cycle": 60,
"dimensions": [
"eth1",
"eth0"
],
"metricDimensions": [
{
"name": "nicName",
"values": [
"eth1",
"eth0"
]
}
]
}
]
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例
{
"success": true,
"data": [
{
"name": "网卡输入流量",
"data": [
[
0,
280.3833333333
]
],
"displayName": "网卡输入流量",
"instanceName": "prod.nmp.nn.yd1 ",
"unit": "Bytes",
"metricDimension": "nicName:eth0",
"decimals": null
},
{
"name": "网卡输入流量",
"data": [
[
0,
48189.416666662495
]
],
"displayName": "网卡输入流量",
"instanceName": "prod.nmp.nn.yd1 ",
"unit": "Bytes",
"metricDimension": "nicName:eth1",
"decimals": null
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询数据面板数据接口:
查询指标单维度数据
请求结构体:
Method: Post
Url: /csm/api/v1/dashboard/metric/billboard
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例:
Post /csm/api/v1/dashboard/metric/billboard
{
"data": [
{
"metric": [
{
"alias": "CPU空闲率",
"cycle": 30,
"displayName": "cpu",
"name": "CpuIdlePercent",
"statistics": "avg",
"unit": "%"
}
],
"monitorObject": [
{
"id": "i-isvkUW76",
"instanceName": "instance-xcy9049y "
}
],
"monitorType": "scope",
"namespace": [
{
"bcmService": "BCE_BCC",
"instanceName": "instance-xcy9049y ",
"name": "i-isvkUW76___bj.BCE_BCC.a0d04d7c202140cb80155ff7b6752ce4",
"namespaceType": "app",
"region": "bj",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
],
"transfer": ""
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"region": "bj",
"scope": "BCE_BCC",
"scopeValue": {
"name": "BCC",
"value": "BCE_BCC"
},
"subService": "linux"
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例:
{
"success": true,
"data": [
{
"name": "CPU空闲率",
"data": [
[
0,
99.600074827175
]
],
"displayName": "CPU空闲率",
"instanceName": "instance-xcy9049y ",
"unit": "%",
"metricDimension": null,
"decimals": null
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询指标多维度数据
请求结构体:
Method: Post
Url: /csm/api/v1/dashboard/metric/billboard
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例:
Post /csm/api/v1/dashboard/metric/billboard
{
"data": [
{
"region": "bj",
"subService": "linux",
"namespace": [
{
"namespaceType": "app",
"transfer": "",
"filter": "",
"name": "41b372b8-3acc-423c-a6b0-af5c69fd1c41___bj.BCE_BEC.a0d04d7c202140cb80155ff7b6752ce4",
"instanceName": "prod.nmp.nn.yd1 ",
"region": "bj",
"bcmService": "BCE_BEC",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
]
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"monitorObject": [
{
"instanceName": "prod.nmp.nn.yd1",
"id": "41b372b8-3acc-423c-a6b0-af5c69fd1c41"
}
],
"scope": "BCE_BEC",
"scopeValue": {
"name": "BEC",
"value": "BCE_BEC",
"hasChildren": false
},
"metric": [
{
"displayName": "",
"name": "vNicInBytes",
"alias": "网卡输入流量",
"unit": "Bytes",
"contrast": [
],
"timeContrast": [
],
"statistics": "avg",
"cycle": 60,
"dimensions": [
"eth1",
"eth0"
],
"metricDimensions": [
{
"name": "nicName",
"values": [
"eth1",
"eth0"
]
}
]
}
]
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例:
{
"success": true,
"data": [
{
"name": "网卡输入流量",
"data": [
[
0,
280.3833333333
]
],
"displayName": "网卡输入流量",
"instanceName": "prod.nmp.nn.yd1 ",
"unit": "Bytes",
"metricDimension": "nicName:eth0",
"decimals": null
},
{
"name": "网卡输入流量",
"data": [
[
0,
48189.416666662495
]
],
"displayName": "网卡输入流量",
"instanceName": "prod.nmp.nn.yd1 ",
"unit": "Bytes",
"metricDimension": "nicName:eth1",
"decimals": null
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
查询图表的高级能力数据
高级能力是指将某一个时间点的平均值 、最大值、 最小值、 和值进行显示; 支持图表的类型有 趋势图、仪表图和数据面板。
请求结构体
Method:Post
Url:/csm/api/v1/dashboard/metric/trend/senior
请求参数
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
paramMap | Map<String, List |
requestBody | 是 | 请求体 |
请求示例
Post /csm/api/v1/dashboard/metric/trend/senior
{
"data": [
{
"metric": [
{
"alias": "CPU空闲率",
"cycle": 30,
"displayName": "cpu",
"name": "CpuIdlePercent",
"statistics": "avg",
"unit": "%"
}
],
"monitorObject": [
{
"id": "i-isvkUW76",
"instanceName": "instance-xcy9049y "
}
],
"monitorType": "scope",
"namespace": [
{
"bcmService": "BCE_BCC",
"instanceName": "instance-xcy9049y ",
"name": "i-isvkUW76___bj.BCE_BCC.a0d04d7c202140cb80155ff7b6752ce4",
"namespaceType": "app",
"region": "bj",
"subService": [
{
"name": "serviceType",
"value": "linux"
}
],
"transfer": ""
}
],
"product": "a0d04d7c202140cb80155ff7b6752ce4",
"region": "bj",
"scope": "BCE_BCC",
"scopeValue": {
"name": "BCC",
"value": "BCE_BCC"
},
"subService": "linux"
}
],
"time": "2023-12-08 09:10:59|2023-12-08 09:11:59"
}
响应示例
{
"success": true,
"data": [
{
"job": {
"product": "a0***************************ce4",
"namespace": "i-isvkUW76___bj.BCE_BCC.a0***************************ce4",
"tags": "",
"alias": "",
"contrast": "",
"metricName": "thirdparty.bcm.CpuIdlePercent",
"startTime": 1701997859,
"endTime": 1701997919,
"period": 300,
"originalPeriod": 60,
"flatten": false,
"statistics": "avg",
"offset": 0,
"bcmSource": false,
"displayName": "cpu",
"instanceName": "instance-xcy9049y ",
"unit": "%",
"decimals": null,
"instanceId": null,
"intranetIp": null,
"items": [
{
"timestamp": 1701997859,
"statisticsValue": {
"cnt": 10,
"sum": 996.5503990165,
"min": 99.4168414293,
"max": 99.7165998665,
"avg": 99.65503990165
}
}
],
"tagsForTsdb": []
},
"numeric": {
"cnt": 10,
"sum": 996.5503990165,
"min": 99.4168414293,
"max": 99.7165998665,
"avg": 99.65503990165
},
"items": [
{
"timestamp": 1701997859,
"statisticsValue": {
"cnt": 10,
"sum": 996.5503990165,
"min": 99.4168414293,
"max": 99.7165998665,
"avg": 99.65503990165
}
}
]
}
],
"message": "ok",
"traceInfo": null,
"code": 200
}
各个图表的区别
组件 | 监控对象-实例 | 监控项 | 其他限制 |
---|---|---|---|
仪表图 | 单选 | 单选 | 只能选择一组数据 |
表格 | 多选 | 单选 | 监控对象50项目,监控项20项;但必须是同一云产品且监控项单位需一致 |
趋势图 | 多选 | 单选 | 支持选择50组数据;监控项单位需保持一致 |
面板 | 单选 | 单选 | 最多选择20组数据;但监控项单位需一致 |
请求体字段的说明:
Configure字段解释说明:
名称 | 类型 | 说明 |
---|---|---|
meric | List |
指标信息 |
monitorObject | List |
实例信息 |
namespace | List |
实例信息 |
product | String | 用户id |
region | String | 地域 |
resourceType | String | 实例类型 |
scopeValue | List |
云产品信息 |
subService | String | 操作系统类型 |
time | String | 时间范围 |
MetricConfiguration解释说明:
名称 | 类型 | 说明 |
---|---|---|
name | String | 指标英文名 |
unit | String | 单位名称 |
alias | String | 指标中文名 |
contrast | List |
可为空 |
timeContrast | List |
可为空 |
statistics | String | 数据的统计方式 |
dimensions | List |
维度信息 |
metricDimensions | List |
维度名称具体维度 |
namespace解释说明:
名称 | 类型 | 说明 |
---|---|---|
namespaceType | String | 实例类型 |
transfer | String | 可为空 |
filter | String | 可为空 |
name | String | 由短id,region,scope和用户id拼接 |
instanceName | String | 实例名称 |
region | String | 地域 |
bcmService | String | 云产品名称 |
subService | List |
云服务类型和操作系统类型 |
monitorObject解释说明:
名称 | 类型 | 描述 |
---|---|---|
id | String | 实例id |
instanceName | String | 实例名称 |
scopeValue解释说明:
名称 | 类型 | 说明 |
---|---|---|
name | String | 云产品名称 |
value | String | 云产品名称 |
hasChildren | String | 是否具有子类型 |
DimensionConfiguration解释说明:
名称 | 类型 | 说明 |
---|---|---|
name | String | 维度名称 |
values | List |
具体维度 |
查询维度接口:
请求结构体:
Method:Get
Url:/csm/api/v1/userId/{userId}/services/{service}/region/{region}/metric/dimensions
请求参数:
名称 | 类型 | 描述 | 是否必须 | 位置 |
---|---|---|---|---|
product | String | 用户id | 是 | Query参数 |
service | String | 云产品名称 | 是 | Query参数 |
region | String | 地域 | 是 | Query参数 |
showId | String | 实例长id | 是 | Query参数 |
dimensions | String | 维度名称 | 否 | Query参数 |
metricName | String | 指标名称 | 是 | Query参数 |
请求示例:
GET-/csm/api/v1/userId/a0***************************ce4/services/BCE_BEC/region/bj/metric/dimensions?dimensions=nicName&metricName=vNicInBytes®ion=bj&service=BCE_BEC&showId=7744b3***********************11534ff&userId=a0***************************ce4&_=1702523903201
响应示例:
{
"nicName": [
"eth1",
"eth0"
]
}