Batch Query Monitoring Data Interface V2
Updated at:2025-11-03
API description
API to obtain data for multiple instances, multiple metrics, and multiple statistics, including Cloud Product Monitor data, Site Monitor data, or Custom Monitor data pushed by users.
API restriction
- For any metric of a specific instance, the number of data points returned in one response cannot exceed 1,440.
- A single request can query up to 100 instances.
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Body |
| scope | String | For cloud product identifiers, please refer to [Cloud Product Identifier List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) | Yes | Body |
| region | String | Region identifier. For values, refer to [Region List](BCM/API Reference/Service domain.md) | Yes | Body |
| type | String | Monitor object type, refer to [Monitor Object Type List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) | Yes | Body |
| metricNames | List<String> | The list of Monitor Metrics is limited to the following character set: "0~9, A~Z, a~z", "_" . When searching for multiple Metric items, use a String array, with each array element being a Metric item |
Yes | Body |
| statistics | List<String> | The list of Statistic Method Types includes average, maximum, minimum, sum, and sampleCount. To query multiple Statistic values, use a String array | Yes | Body |
| dimensions | List<List<Dimension>> | List of dimensions. When querying data for multiple instances, use a two-dimensional array: the first-level array specifies multiple instances, and the second-level array specifies multiple dimensions. | Yes | Body |
| startTime | String | Query start time, please refer to [Date and Time](BCM/API Reference/General Description.md#Date and time regulations), expressed in UTC | Yes | Body |
| endTime | String | Query end time, please refer to [Date and Time](BCM/API Reference/General Description.md#Date and time regulations), expressed in UTC | Yes | Body |
| cycle | int | Statistic Period, multiples of 60, unit: seconds | Yes | Body |
Dimension
| Name | Types | Description |
|---|---|---|
| name | String | Dimension key |
| value | String | Dimension value |
Parameter explanation
- For concepts like Scope, Metric, Statistic, and Dimension, refer to [Core Concepts](BCM/Product Description/Core concepts.md).
Response result
| Name | Types | Description |
|---|---|---|
| requestId | String | Request identifier |
| code | String | Return code |
| message | String | Error message |
| metrics | List<AllDataMetric> | Monitor Metric |
AllDataMetric
| Name | Types | Description |
|---|---|---|
| region | String | Region |
| scope | String | Cloud product identifier |
| userId | String | User ID |
| resourceId | String | Resource ID |
| metricName | String | Metric name |
| dimensions | List<Dimension> | Dimension list |
| dataPoints | List<DataPoints> | Metric data |
DataPoints
| 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 statistical period of Metric, refer to [Date and Time](BCM/API Reference/General Description.md#Date and time regulations), expressed in UTC date |
Request example
Plain Text
1MultiDimensionalMetricsRequest request = new MultiDimensionalMetricsRequest();
2request.setUserId("453bf9********************9090dc");
3request.setScope("BCE_BCC");
4List<String> metricNames = new ArrayList<String>();
5metricNames.add("CPUUsagePercent");
6metricNames.add("MemUsedPercent");
7request.setMetricNames(metricNames);
8request.setStartTime("2024-03-26T07:01:00Z");
9request.setEndTime("2024-03-26T07:05:00Z");
10List<List<Dimension>> dimensions = new ArrayList<List<Dimension>>();
11List<Dimension> d1 = new ArrayList<Dimension>();
12d1.add(new Dimension("InstanceId", "i-M9****s1"));
13List<Dimension> d2 = new ArrayList<Dimension>();
14d2.add(new Dimension("InstanceId", "i-8y****gG"));
15dimensions.add(d1);
16dimensions.add(d2);
17request.setDimensions(dimensions);
18List<String> statistics = new ArrayList<String>();
19statistics.add("sum");
20statistics.add("average");
21request.setStatistics(statistics);
22request.setRegion("bj");
23TsdbMetricAllDataResult result = bcmClient.getAllDataMetricV2(request);
Response result
Plain Text
1{
2 "metadata": {
3 "bceRequestId": "9cc92f21-d697-4133-bf2d-bf5f944ce752",
4 "transferEncoding": "chunked",
5 "contentLength": -1,
6 "contentType": "application/json;charset=UTF-8",
7 "date": 1711508479000
8 },
9 "requestId": "9cc92f21-d697-4133-bf2d-bf5f944ce752",
10 "code": "success",
11 "message": "",
12 "metrics": [
13 {
14 "region": "bj",
15 "scope": "BCE_BCC",
16 "userId": "453bf9********************9090dc",
17 "resourceId": "i-8y****gG",
18 "metricName": "CPUUsagePercent",
19 "dimensions": [
20 {
21 "name": "InstanceId",
22 "value": "i-8y****gG"
23 }
24 ],
25 "dataPoints": [
26 {
27 "timestamp": "2024-03-26T07:01:00Z",
28 "average": 7.9346566231995,
29 "sum": 15.869313246399
30 }
31 ]
32 },
33 {
34 "region": "bj",
35 "scope": "BCE_BCC",
36 "userId": "453bf9********************9090dc",
37 "resourceId": "i-M9****s1",
38 "metricName": "MemUsedPercent",
39 "dimensions": [
40 {
41 "name": "InstanceId",
42 "value": "i-M9****s1"
43 }
44 ],
45 "dataPoints": [
46 {
47 "timestamp": "2024-03-26T07:01:00Z",
48 "average": 27.4557088036185,
49 "sum": 54.911417607237
50 }
51 ]
52 },
53 {
54 "region": "bj",
55 "scope": "BCE_BCC",
56 "userId": "453bf9********************9090dc",
57 "resourceId": "i-M9****s1",
58 "metricName": "CPUUsagePercent",
59 "dimensions": [
60 {
61 "name": "InstanceId",
62 "value": "i-M9****s1"
63 }
64 ],
65 "dataPoints": [
66 {
67 "timestamp": "2024-03-26T07:01:00Z",
68 "average": 3.400926389583,
69 "sum": 6.801852779166
70 }
71 ]
72 },
73 {
74 "region": "bj",
75 "scope": "BCE_BCC",
76 "userId": "453bf9********************9090dc",
77 "resourceId": "i-8y****gG",
78 "metricName": "MemUsedPercent",
79 "dimensions": [
80 {
81 "name": "InstanceId",
82 "value": "i-8y****gG"
83 }
84 ],
85 "dataPoints": [
86 {
87 "timestamp": "2024-03-26T07:01:00Z",
88 "average": 20.5017433695395,
89 "sum": 41.003486739079
90 }
91 ]
92 }
93 ]
94}
