All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

GetMetricStatisticsBatch

Last updated:2026-03-18 14:12:49

Here is the full English translation, formatted consistently with the previous two pages:


GetMetricStatisticsBatch

Call the GetMetricStatisticsBatch API to query real-time monitoring data from within the last 15 minutes (within the past 30 days).


Description

Field

Value

API Name

GetMetricStatisticsBatch

Request Method

POST

Endpoint

monitor.api.ksyun.com

VPC Internal Endpoint

monitor.internal.api.ksyun.com

Version

2018-11-14

Rate Limit & Constraint Notice:

  • The number of monitoring metrics per request must not exceed 200.

  • Per-user API call limit: up to 180 requests per minute (except for special data centers).

  • Maximum records returned per single request: 6,000.

  • If the query interval exceeds 30 minutes, some queries may be slow and result in a timeout. When a metric query fails, the response will include the failure reason alongside data for any successfully queried instances.


Request Parameters

The table below lists the API-specific request parameters only. When making actual API calls, you must also include the common request parameters. Refer to the Common Request Parameters page for details.

The Action field for this API is GetMetricStatisticsBatch.

Parameter

Required

Type

Description

Namespace

Yes

String

Identifies a category of cloud product. Specifies the namespace.

StartTime

Yes

String

Local start time timestamp. Format: 2017-02-28T17:00:00Z

EndTime

Yes

String

Local end time timestamp. Format: 2017-02-28T18:00:00Z. Note: Data collection has an approximate 2-minute delay. EndTime should be set at least 2 minutes behind the current time.

Period

No

Integer

Statistical granularity in seconds; must be an integer multiple of 60. Inconsistency with the console setting may cause data discrepancies. When left empty (default), no downsampling is applied — data is returned at the product's native push frequency.

Aggregate

Yes

[]String

Data aggregation methods. Supported values: Average, Max, Min. Inconsistency with the console setting may cause data discrepancies.

Metrics

Yes

Array of MetricObject

List of monitored instances and their corresponding metric names. See the Metrics sub-table below.

Metrics Object

Parameter

Required

Type

Description

InstanceID

Yes

String

The ID of the monitored instance. Note: For MongoDB, prefix the instance ID with user.

MetricName

Yes

String

The name of the monitoring metric.


Response Parameters

Field

Type

Description

Datapoints

Array

Monitoring data retrieved using the specified aggregation method.

Label

String

The monitoring metric name.

Instance

String

The ID of the monitored instance.

RequestId

String

Unique request ID.


Request Examples

Example: Batch Query Monitoring Data for Multiple Instances

Request
Replace ${region} with the appropriate region code. See: Region Reference.
https://monitor.${region}.api.ksyun.com?Action=GetMetricStatisticsBatch&Version=2018-11-14

POST Body:

{
  "Namespace": "kec",
  "StartTime": "2018-10-18T15:00:00Z",
  "EndTime": "2018-10-18T15:01:00Z",
  "Period": 60,
  "Aggregate": ["Max", "Min", "Avg", "sum", "count"],
  "Metrics": [
    {
      "InstanceID": "55e38556-8f92-4c7a-99d4-8b746a340d79",
      "MetricName": "cpu.utilizition.total"
    },
    {
      "InstanceID": "dab25452-9426-4e4e-870d-4491f638a598",
      "MetricName": "net.if.in"
    },
    {
      "InstanceID": "9e00656d-ba3b-427c-b1e8-0d43a9f1fc0f",
      "MetricName": "net.if.in1"
    }
  ]
}
Successful Response (with Partial Errors)

The response supports XML format. If certain metrics fail to query (e.g., due to an invalid metric name), the failed items are reported in ErrorMessages, while successfully queried instances still return their data.

XML Format

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GetMetricStatisticsBatchV2Response xmlns="https://ksyun.kingeyes.com/">
    <ErrorMessages>
        <ErrorMessage>No such name for 'metrics': 'net.if.in1.9e00656d-ba3b-427c-b1e8-0d43a9f1fc0f'</ErrorMessage>
    </ErrorMessages>
    <GetMetricStatisticsBatchResults>
        <GetMetricStatisticsBatchResult>
            <Datapoints>
                <member>
                    <Average>0.06</Average>
                    <Max>0.06</Max>
                    <Min>0.06</Min>
                    <SampleCount>1</SampleCount>
                    <Sum>0</Sum>
                    <Timestamp>2018-10-18T15:00:00Z</Timestamp>
                </member>
                <member>
                    <Average>0.062</Average>
                    <Max>0.062</Max>
                    <Min>0.062</Min>
                    <SampleCount>1</SampleCount>
                    <Sum>0</Sum>
                    <Timestamp>2018-10-18T15:01:00Z</Timestamp>
                </member>
            </Datapoints>
            <Instance>55e38556-8f92-4c7a-99d4-8b746a340d79</Instance>
            <Label>cpu.utilizition.total</Label>
        </GetMetricStatisticsBatchResult>
        <GetMetricStatisticsBatchResult>
            <Datapoints>
                <member>
                    <Average>170914.5</Average>
                    <Max>339183.0</Max>
                    <Min>2646.0</Min>
                    <SampleCount>2</SampleCount>
                    <Sum>341829</Sum>
                    <Timestamp>2018-10-18T15:00:00Z</Timestamp>
                </member>
                <member>
                    <Average>176691.5</Average>
                    <Max>350734.0</Max>
                    <Min>2649.0</Min>
                    <SampleCount>2</SampleCount>
                    <Sum>353383</Sum>
                    <Timestamp>2018-10-18T15:01:00Z</Timestamp>
                </member>
            </Datapoints>
            <Instance>dab25452-9426-4e4e-870d-4491f638a598</Instance>
            <Label>net.if.in</Label>
        </GetMetricStatisticsBatchResult>
    </GetMetricStatisticsBatchResults>
    <ResponseMetadata>
        <RequestId>b19ddb6b-c828-4a42-b90a-f27a88680fdf</RequestId>
    </ResponseMetadata>
</GetMetricStatisticsBatchV2Response>

Note on Partial Failures: In the example above, the third metric (net.if.in1 for instance 9e00656d-...) failed because the metric name does not exist. The error is reported in <ErrorMessages>, but data for the other two successfully queried instances is still returned in <GetMetricStatisticsBatchResults>.


Error Codes

The table below lists only the error codes specific to this API's business logic. For all other error codes, refer to Common Error Codes.

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback