API description
Monitor data from cloud products within a specified time range can be fetched using multiple dimensions, a single metric, and various statistics.
API restriction
- For any metric of a specific instance, the number of data points returned in one response cannot exceed 1,440.
- Each query can include up to 100 dimension combinations.
Request structure
- Method: POST
- Url: /csm/api/v2/userId/{userId}/services/{service}/data/metricData/PartialDimension
Request parameters
| Name |
Types |
Description |
Required or not |
Parameter location |
| userId |
String |
User ID |
Yes |
Path |
| service |
String |
Cloud product identifier. For values, refer to [Cloud Product Identifier List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) |
Yes |
Path |
| startTime |
String |
Monitor data start time, refer to [Date and Time](BCM/API Reference/General Description.md), expressed in UTC date |
Yes |
Body |
| endTime |
String |
Monitor data end time, refer to [Date and Time](BCM/API Reference/General Description.md), expressed in UTC date |
Yes |
Body |
| statistics |
List<String> |
List of Statistic Method Types, options: average, maximum, minimum, sum, sampleCount. |
Yes |
Body |
| cycle |
int |
Statistical period, unit: second, default value: 60 |
No |
Body |
| dimensions |
List<Dimension> |
Dimension list |
Yes |
Body |
| resourceType |
String |
Monitor object type. For values, refer to [Cloud Product Monitor Object Type List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) |
No |
Body |
| metricName |
String |
Monitor Metric name |
Yes |
Body |
| region |
String |
Region identifier. For values, refer to [Region List](BCM/API Reference/Service domain.md) |
No |
Body |
| pageNo |
int |
Page number, defaulting to 1 |
No |
Body |
| pageSize |
int |
Page size, default: 10, maximum: 100 |
No |
Body |
Dimension
| Name |
Types |
Description |
Required or not |
| name |
String |
Dimension key |
Yes |
| value |
String |
Dimension value |
Yes |
Response parameters
| Name |
Types |
Description |
| requestId |
String |
Request identifier |
| code |
String |
Return code |
| message |
String |
Error message |
| result |
PageResult |
Paginated results |
| Name |
Types |
Description |
| pageNo |
int |
Page number |
| pageSize |
int |
Page size |
| totalCount |
int |
Total count |
| result |
List<AllDataMetric> |
List of Monitor Metrics |
AllDataMetric
| Name |
Types |
Description |
| region |
String |
Region identifier |
| scope |
String |
Cloud product identifier |
| userId |
String |
User ID |
| resourceId |
String |
Resource ID |
| metricName |
String |
Monitor Metric name |
| dimensions |
List<Dimensions> |
Dimension list |
| dataPoints |
List<DataPoint> |
Monitor Metric data |
DataPoint
| Name |
Types |
Description |
| average |
double |
Average of Metrics within the statistical period |
| sum |
double |
Sum of Metrics within the statistical period |
| minimum |
double |
Minimum value of Metrics within the statistical period |
| maximum |
double |
Maximum value of Metrics within the counting cycle |
| sampleCount |
int |
Number of DataPoints for the Metric within the statistical period |
| timestamp |
String |
Time corresponding to the monitor data |
Request example
ak := "ALTAKr*****************CYG"
sk := "b2c53**********************93ac1"
userId := "a0d04***********************2ce4"
endpoint := "http://bcm.bj.baidubce.com"
bcmClient, _ := NewClient(ak, sk, endpoint)
req := &model.MetricsByPartialDimensionsRequest{
UserID: userId,
Scope: "BCE_BLB",
Region: "bj",
Dimensions: []model.Dimension{
{
Name: "BlbPortType",
Value: "TCP",
},
},
Statistics: []string{"sum"},
ResourceType: "Blb",
MetricName: "ActiveConnCount",
StartTime: "2024-03-20T02:21:17Z",
EndTime: "2024-03-20T03:21:17Z",
PageNo: 1,
PageSize: 1,
}
response, err := bcmClient.GetMetricsByPartialDimensions(req)
Response example
{
"requestId": "bfdb5d91-39e6-4c35-aa73-caf76ad3440f",
"code": "success",
"message": "",
"result": {
"pageNo": 1,
"pageSize": 1,
"totalCount": 66,
"result": [{
"region": "bj",
"scope": "BCE_BLB",
"userId": "a0d04d7c***************7b6752ce4",
"resourceId": "lb-****8446",
"metricName": "ActiveConnCount",
"dimensions": [{
"name": "BlbId",
"value": "lb-****8446"
}, {
"name": "BlbPort",
"value": "3306"
}, {
"name": "BlbPortType",
"value": "TCP"
}],
"dataPoints": [{
"sum": 0.0,
"timestamp": "2024-03-20T02:21:17Z"
}, {
"sum": 0.0,
"timestamp": "2024-03-20T02:22:17Z"
},
{
"sum": 0.0,
"timestamp": "2024-03-20T03:19:17Z"
}, {
"sum": 0.0,
"timestamp": "2024-03-20T03:20:17Z"
}, {
"timestamp": "2024-03-20T03:21:17Z"
}]
}]
}
}