百度智能云

All Product Document

          Cloud Monitor

          Dimension Value TopN and Monitoring Data Query Interface

          API description

          This API retrieves the TopN dimension values for a specified metric under certain dimensions associated with a cloud product instance.

          Request parameters

          Name Types Description Required or not Parameter location
          userId String User ID Yes Body
          scope 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 Body
          region String Region identifier. For values, refer to [Region List](BCM/API Reference/Service domain.md) Yes Body
          metricName String Monitor Metric name, limited to the following character set: "0~9, A~Z, a~z", "_" Yes Body
          statistics String Statistic method type. Optional values: average, maximum, minimum, sum, sampleCount. Yes Body
          dimensions Map<String, String> Instance dimensions and metric dimensions, instance dimensions: Instance ID or parent instance ID (required); metric dimensions: Dimensions carried by the monitoring metric (optional) Yes Body
          labels Set<String> Metric dimensions to be sorted Yes Body
          startTime String Monitor data start time, refer to [Date and Time](BCM/API Reference/General Description.md), in UTC format 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
          order String Sorting method, optional values top (descending), bottom (ascending), default top No Body
          topNum int Number of topNum items retained after sorting, default: 10, maximum: 1000 No Body

          Parameter explanation

          • For concepts like Scope, Metric, Statistic, and Dimension, refer to [Core Concepts](BCM/Product Description/Core concepts.md).

          Response parameters

          Name Types Description
          requestId String Request identifier ID
          userId String User ID
          serviceName String Cloud product identifier
          metricName String Metric name
          resourceId String Instance ID
          dimensions List<Dimension> Metric dimension
          dataPoints List<TsdbQueryDataPoint> Monitor Metric data

          Dimension

          Name Types Description
          name String Dimension name
          value String Dimension value

          TsdbQueryDataPoint

          Name Types Description
          timestamp String Time corresponding to the monitor data
          average Double Average of Metrics within the statistical period
          sum Double Sum of Metrics within the statistical period
          maximum Double Maximum value of Metrics within the counting cycle
          minimum Double Minimum value of Metrics within the statistical period
          sampleCount Integer Number of DataPoints for the Metric within the statistical period

          Request example

          // config of client
          String endpoint = "http://bcm.bj.baidubce.com";
          String userId = "a0d04d7c***************7b6752ce4";
          String ak = "ALTAK***************3hVCYG";
          String sk = "b2c53*******************f9993ac1";
          // create a bcm client
          BcmClientConfiguration config = new BcmClientConfiguration();
          config.setCredentials(new DefaultBceCredentials(ak, sk));
          config.setEndpoint(endpoint);
          BcmClient bcmClient = new BcmClient(config);
          TsdbDimensionTopQuery request = new TsdbDimensionTopQuery();
          request.setUserId(userId);
          request.setScope("BCE_NAT");
          request.setRegion("bj");
          request.setMetricName("ConnNumber");
          request.setStatistics("average");
          request.setStartTime("2024-04-27T07:10:01Z");
          request.setEndTime("2024-04-27T07:20:01Z");
          Map<String, String> dimensionMap = new HashMap<>();
          dimensionMap.put("NatId", "nat-bm********f8");
          request.setDimensions(dimensionMap);
          Set<String> labels = new HashSet<>();
          labels.add("FixIp");
          request.setLabels(labels);
          request.setTopNum(2);
          request.setCycle(60);
          TsdbDimensionTopResult result = bcmClient.getMetricDimensionTop(request);

          Response example

          [
              {
                  "requestId": "3adb033a103945c0921914c4c23d6ab8",
                  "userId": "453bf9********************9090dc",
                  "serviceName": "BCE_NAT",
                  "metricName": "ConnNumber",
                  "resourceId": "nat-be********cw",
                  "dimensions": [
                      {
                          "name": "FixIp",
                          "value": "100.2.107.13"
                      }
                  ],
                  "dataPoints": [
                      {
                          "timestamp": "2024-07-08T11:30:53Z",
                          "average": 335.0
                      },
                      {
                          "timestamp": "2024-07-08T11:31:53Z",
                          "average": 367.0
                      },
                      {
                          "timestamp": "2024-07-08T11:32:53Z",
                          "average": 456.0
                      }
                  ]
              },
              {
                  "requestId": "3adb033a103945c0921914c4c23d6ab8",
                  "userId": "453bf9********************9090dc",
                  "serviceName": "BCE_NAT",
                  "metricName": "ConnNumber",
                  "resourceId": "nat-be********cw",
                  "dimensions": [
                      {
                          "name": "FixIp",
                          "value": "100.2.107.14"
                      }
                  ],
                  "dataPoints": [
                      {
                          "timestamp": "2024-07-08T11:30:53Z",
                          "average": 153.0
                      },
                      {
                          "timestamp": "2024-07-08T11:31:53Z",
                          "average": 148.0
                      },
                      {
                          "timestamp": "2024-07-08T11:32:53Z",
                          "average": 142.0
                      }
                  ]
              }
          ]
          Previous
          BcmClient
          Next
          Dimension Value TopN Query Interface