百度智能云

All Product Document

          Cloud Monitor

          Batch Query Monitoring Data Interface V2

          API description

          Monitor data for cloud products within a specified time range can be retrieved based on various dimensions, metrics, and 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
          • Request URL: /csm/api/v2/data/metricAllData

          Request parameters

          Name Types Description Required or not Parameter location
          userId String User ID Yes Body
          scope String Cloud product identifier. For values, 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, please refer to [Region List](BCM/API Reference/Service domain.md) Yes Body
          type String Monitor object type, default value: Instance. For values, please refer to [Cloud Product Monitor Object Type List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) Yes Body
          metricNames List<String> List of Monitor Metrics Yes Body
          statistics List<String> List of Statistic Method Types, options: average, maximum, minimum, sum, sampleCount. Yes Body
          dimensions List<List<Dimension>> Dimension list Yes Body
          cycle int Statistical period, unit: second, default value: 60 No Body
          startTime String Monitor data start time, please refer to [Date and Time](BCM/API Reference/General Description.md), in UTC format Yes Body
          endTime String Monitor data end time, please refer to [Date and Time](BCM/API Reference/General Description.md), expressed in UTC date Yes Body

          Dimension

          Name Types Description Required or not
          name String Dimension key Yes
          value String Dimension value Yes

          Parameter explanation

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

          Response parameters

          Name Types Description
          requestId String Request identifier ID
          code String Return code
          message String Error message
          metrics List<AllDataMetric> Monitor Metric data

          AllDataMetric

          Name Types Description
          region String Region
          scope String Cloud product name
          userId String User ID
          resourceId String Resource ID
          metricName String Monitor Metric name
          dimensions List<Dimensions> List of Monitor Metric Dimensions
          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

          {
              "userId": "453bf9********************9090dc",
              "scope": "BCE_MQ_KAFKA",
              "region": "bj",
              "type": "Node",
              "metricNames": ["CpuUsedPercent"],
              "statistics": ["average", "sum", "sampleCount"],
              "dimensions": [
                  [
                      {
                          "name": "ClusterId",
                          "value": "efe456d667******b890652c93812a79"
                      },
                      {
                          "name": "NodeId",
                          "value": "i-Um1V8Haq"
                      }
                  ]
              ],
              "cycle": 60,
              "startTime": "2024-03-21T06:33:50Z",
              "endTime": "2024-03-21T07:33:50Z"
          }

          Response example

          {
              "requestId": "f6cb4648-26bd-****-****-4f68afa9d2e6",
              "code": "success",
              "message": "",
              "metrics": [
                  {
                      "region": "bj",
                      "scope": "BCE_MQ_KAFKA",
                      "userId": "453bf9********************9090dc",
                      "resourceId": "i-Um1V8Haq",
                      "metricName": "CpuUsedPercent",
                      "dimensions": [
                          {
                              "name": "ClusterId",
                              "value": "efe456d667******b890652c93812a79"
                          },
                          {
                              "name": "NodeId",
                              "value": "i-Um1V8Haq"
                          }
                      ],
                      "dataPoints": [
                          {
                              "average": 0.959692898272,
                              "sum": 0.959692898272,
                              "sampleCount": 1,
                              "timestamp": "2024-03-21T06:33:50Z"
                          }
                      ]
                  }
              ]
          }
          Previous
          Application Monitor
          Next
          Common Request and Response Headers