- Print
- PDF
QueryDataMultiple
- Print
- PDF
Summary
This API queries multiple time-series data collected by Cloud Insight.
Request
API URL
URL: https://cw.apigw.ntruss.com/cw_fea/real/cw/api/data/query/multiple
Method: POST
Request header
The request headers specified in common settings are required.
Content-Type: application/json
x-ncp-apigw-signature-v2: {generated signature}
x-ncp-apigw-timestamp: {current timestamp}
x-ncp-iam-access-key: {your iam access key}
Request Body
Parameter Name | Requirement status | Type | Restrictions | Description |
---|---|---|---|---|
timeStart | Y | Long | Input in units of milliseconds | Query start time |
timeEnd | Y | Long | Input in units of milliseconds | Query end time |
metricInfoList | Y | List<DataQueryRequestMetricInfo> | Multiple query conditions can be specified (defined in an array of metricInfo). |
{
"metricInfoList": [
{
"prodKey": "string",
"metric": "string",
"interval": "string",
"aggregation": "string",
"queryAggregation": "string",
"dimensions": {
"string": "string"
}
},
{
"prodKey": "string",
"metric": "string",
"interval": "string",
"aggregation": "string",
"queryAggregation": "string",
"dimensions": {
"string": "string"
}
}
],
"timeStart": "long",
"timeEnd": "long"
}
Reference:
aggregation
refers to the aggregation function that is executed when data is streamed into the system before writing the data in the database.It is necessary to match the aggregation function configured during the schema registration and the aggregation in the data query request since the user can't retrieve the data if they don't match.
The recommended query period (timeEnd - timeStart) varies, depending on the data aggregation interval. Refer to the Recommended query period by data aggregation interval for details.
Example
Request Example
The following code is an example of querying the avg_cpu_used_rto (Metric) value of the server with instanceNo (Dimension) value "123456" and the avg_read_byt_cnt (Metric) value of the server with instanceNo (Dimension) value "345678" in the "System/Server(VPC) (cw_key : 460438474722512896)" product.
POST /cw_fea/real/cw/api/data/query/multiple
Host: cw.apigw.ntruss.com
Content-Type: application/json
x-ncp-apigw-signature-v2: {generated signature}
x-ncp-apigw-timestamp: {current timestamp}
x-ncp-iam-access-key: {your iam access key}
Payload:
{
"metricInfoList": [
{
"aggregation": "AVG",
"dimensions": {
"instanceNo": "123456"
},
"interval": "Min30",
"metric": "avg_cpu_used_rto",
"prodKey": "460438474722512896",
},
{
"aggregation": "AVG",
"dimensions": {
"instanceNo": "345678"
},
"interval": "Min30",
"metric": "avg_read_byt_cnt",
"prodKey": "460438474722512896"
}
],
"timeEnd": 1587974615395,
"timeStart": 1587963815395
}
Response Example
The result is returned in a JSON array when the data search is completed without any errors.
[
{
"aggregation": "AVG",
"dimensions": {
"instanceNo": "123456"
},
"dps": [
[
1588746600000,
1.9561905
],
[
1588748400000,
1.9634359
],
[
1588750200000,
1.9742627
],
[
1588752000000,
1.9790177
],
[
1588753800000,
1.9686635
]
],
"interval": "Min30",
"metric": "avg_cpu_used_rto",
"productName": "Server(VPC)"
},
{
"aggregation": "AVG",
"dimensions": {
"instanceNo": "345678"
},
"dps": [
[
1588746600000,
529.06647
],
[
1588748400000,
529.06647
],
[
1588750200000,
529.06647
],
[
1588752000000,
529.06647
],
[
1588753800000,
529.06647
]
],
"interval": "Min30",
"metric": "avg_read_byt_cnt",
"productName": "Server(VPC)"
}
]