Query Index

Last updated: 2019-11-29 18:56:22

PDF

1. API Description

This API (DescribeMetric) is used to view the metrics created under a namespace.

Domain name: monitor.api.qcloud.com

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters are also needed when the API is called. For more information, please see Common Request Parameters page. The Action field for this API is DescribeMetric.

Parameter Name Required Type Description
namespace Yes String Query the metrics under the namespace. This can be queried by calling the API Query Namespace (DescribeNamespace)
metricName No String Filtering by metric name. Information of all the metrics under the namespace will be returned if this is left empty.

3. Output Parameters

Parameter Name Type Description
code Int Error code, 0: Successful; other values: Failed. For more information, please see Error Codes
message String Error message
data Array Returned array

Each metric returned by "data" is defined as follows:

Parameter Name Type Description
namespace String Namespace where the metric resides in
metricName String Metric name
metricCname String Chinese name of the metric
dimension String Metric dimension name
unit String Unit of the reported data
statisticsType Array Statistical type
aggeration Array Aggregation dimension. You can view aggregation information using API Create Metric Aggregation

"statisticsType" is composed as follows:

Parameter Name Type Description
period Int Statistical period. The time interval for data collection. Currently, default is 300 seconds, which cannot be modified
statistics String Statistical method function, which analyzes the data set within a specified statistical period. Available analytic methods are: max (to take the maximum value in the data set), min (to take the minimum value in the data set), sum (to take the sum of all data in the data set), avg (to take the average value of all data in the data set), last (to take the last value in the data set)

For the array of aggregation, key is the group of aggregated dimension names, and value is statistical type

4. Error Codes

Error Code Error Description Error Message
-503 Incorrect request parameter InvalidParameter
-505 Parameter is missing InvalidParameter.MissingParameter
-507 Limit has been exceeded OperationDenied.ExceedLimit
-509 Incorrect dimension group InvalidParameter.DimensionGroupError
-513 DB operation failed InternalError.DBoperationFail

5. Example

Input

 https://domain/v2/index.php?Action=DescribeMetric
 &<Common request parameters>
 &namespace=cvm

Output

{
    "code": 0,
    "message": "",
    "data": {
        "cvm": {
            "diskusage": {
                "namespace": "cvm",
                "metricName": "diskusage",
                "unit": "'%'",
                "metricCname": ""Machine disk utilization"",
                "dimension": "diskname,ip",
                "statisticsType": [
                    {
                        "period": "300",
                        "statistics": "max"
                    },
                    {
                        "period": "300",
                        "statistics": "avg"
                    }
                ],
                "aggeration": {
                    "ip": [
                        {
                            "period": "300",
                            "statistics": "max"
                        }
                    ]
                }
            }
        }
    }
}