GetUsage

最近更新时间:2020-07-27 10:13:46

请求语法

POST /GetUsage HTTP/1.1
Authorization: <AuthorizationString>
x-klog-api-version: 0.1.0
Host: <Project Endpoint>
x-klog-signature-method: hmac-sha1
Date: <GMT Date>
Content-Type: application/json
Content-MD5: <Content-MD5>
Content-Length: <ContentLength>
Connection: Keep-Alive
{
  Projects: List<string> //项目列表
}

请求参数

该接口无特有请求头。获取更多信息,请参见公共请求头。 参数详情具体如下表。

参数名称 类型 是否必须 描述
Projects List 项目名称列表
Metrics List 指标名称列表,不传返回所有;WriteFlow,ReadFlow,Storage,SearchRequests,WriteRequests
From String 开始时间戳
To String 结束时间戳

响应参数

参数详情具体如下表。

参数名称 类型 描述
Data List 图表名称
TimeSeries List 时间戳序列
  • Metric
参数名称 类型 描述
MetricName String 指标名称
Output List 指标列表,每个时间戳一个
YesterdayUsage int64 昨日数据
DayToDayRatio int64 日环比

示例

请求示例

POST /GetChartNamesByIds HTTP/1.1
Authorization: KLOG <yourAccessKeyId>:<yourSignature>
x-klog-api-version: 0.6.0
Host: klog-cn-beijing-internal.ksyun.com
x-log-signature-method: hmac-sha1
Date: Sun, 27 May 2018 07:43:26 GMT
Content-Type: application/json
Content-MD5: A7967D81EFF5E3CD447FB6D8DF294E20
Content-Length: 80
Connection: Keep-Alive
{
    "Projects": ["my-project1", "my-project2"],
    "Metrics":["writeFlow", "readFlow"],
    "From": "2020-06-15 17:25:40",
    "To": "2020-06-25 17:25:40"
}

响应示例

HTTP/1.1 200
Server: nginx
Content-Length: 0
Connection: close
Access-Control-Allow-Origin: *
Date: Sun, 27 May 2018 07:43:27 GMT
x-klog-requestid: 5B0A619F205DC3F30EDA9322
{
    "TimeSeries" : [1589277626, 1589277626, 1589277626]
    "Data" : [
        {
            "MetricName": "writeFlow",
            "YesterdayUsage": 13089,
            "DayToDayRatio": 1.5,
            "Output" [1000, 10000, 23231, 123123]
        },
        {
            "MetricName": "inFlow",
            "YesterdayUsage": 13089,
            "DayToDayRatio": 1.5,
            "Output" [1000, 10000, 23231, 123123]
        }
    ]
}

金山云,开启您的云计算之旅

免费注册