全部文档
当前文档

暂无内容

如果没有找到您期望的内容,请尝试其他搜索词

文档中心

批量获取数据接口

最近更新时间:2023-12-26 20:25:30

批量获取监控数据接口(实时数据)

1.接口描述

2.输入参数

3.输出参数

4.示例

1.接口描述

域名:monitor.api.ksyun.com

VPC内调用域名:monitor.internal.api.ksyun.com

接口名: GetMetricStatisticsBatch

version=2018-11-14

批量查询数据接口支持查询最近15min以内的实时数据(30天以内)。

一次请求的监控指标数量不能超过200,用户单位时间内调用API次数,除特殊机房外其他机房每分钟最多180次请求。

用户获取监控数据返回值,单次最多返回6000条数据。

若查询间隔>30min,可能出现某些数据查询较慢而超时。指标查询失败时,会返回查询失败的原因和成功实例的数据。

2.输入参数

以下请求参数列表仅列出了接口请求参数,正式调用时需要加上公共请求参数,见公共请求参数页面。

其中此接口的Action字段为GetMetricStatisticsBatch。

参数名称

必选

类型

描述

Namespace

String

表示一类云产品,指定命名空间。

StartTime

String

本地时间,开始时间戳,如2017-02-28T17:00:00Z

EndTime

String

本地时间,结束时间戳,如2017-02-28T18:00:00Z, 数据采集有2分钟左右延迟,EndTime需比当前时间延迟两分钟

Period

Interger

60的整数倍,如果和控制台不一致,会导致数据不一致。默认值为空,将不对数据进行降采样,按产品线的推送频率进行展示。

Aggregate

[]String

数据聚合的方法,Average,Max,Min ,如果和控制台不一致,会导致数据不一致

Metrics

[]String

监控实例及监控项

Metrics

参数名称

必选

类型

描述

InstanceID

String

监控实例的ID
备注:MongoDB产品,请在相应监控实例ID前添加user前缀

MetricName

String

监控项名称

3.输出参数

参数名称

类型

描述

Datapoints

Array

按照指定的统计方法获取的监控数据

Label

String

监控指标

Instance

String

监控实例的ID

RequestId

String

请求ID

4.示例

输入

https://monitor.${region}.api.ksyun.com?
Action=GetMetricStatisticsBatch
&Version=2018-11-14
POST:
{
"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"
}]
}

${region}可替换相应区域,详见region说明

输出


<?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>

文档导读
纯净模式常规模式

纯净模式

点击可全屏预览文档内容
文档反馈