GetMonitorData

Last updated: 2020-02-01 21:00:19

1. API Description

Domain name for API request: monitor.tencentcloudapi.com.

This API is used to get the monitoring data of a Tencent Cloud product by passing in the product's namespace, object dimension description, and monitoring metric.
API call rate limit: 20 calls/sec, 1,200 calls/min.
If you need to call a lot of metrics and objects, there may be cases where the call fails due to the rate limit. It is recommended to spread the call requests as much as possible over time.

A maximum of 20 requests can be initiated per second for this API.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: monitor.ap-shanghai-fsi.tencentcloudapi.com

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: GetMonitorData
Version Yes String Common parameter. The value used for this API: 2018-07-24
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
Namespace Yes String Namespace. Each Tencent Cloud product has a namespace
MetricName Yes String Metric name.
Instances.N Yes Array of Instance Combination of instance object dimensions
Period No Integer Monitoring statistical period. The default value is 300, and the unit is s
StartTime No Timestamp Start time such as 2018-09-22T19:51:23+08:00
EndTime No Timestamp End time. Uses the current time by default and cannot be earlier than StartTime

3. Output Parameters

Parameter Name Type Description
Period Integer Statistical period
MetricName String Metric name
DataPoints Array of DataPoint Array of data points
StartTime Timestamp Start time
EndTime Timestamp End time
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Getting the Monitoring Data of a CVM Instance

This API is used to get the 5-minute CPU utilization monitoring data of a CVM instance in a certain period of time.

Input Example

https://monitor.tencentcloudapi.com/?Action=GetMonitorData
&Namespace=QCE/CVM
&MetricName=CPUUsage
&Period=300
&StartTime=2019-02-24T10:51:23+08:00
&EndTime=2019-03-24T20:51:23+08:00
&Instances.0.Dimensions.0.Name=InstanceId
&Instances.0.Dimensions.0.Value=ins-j0hk02zo
&<Common request parameter>

Output Example

{
  "Response": {
    "StartTime": "2018-08-24 10:50:00",
    "EndTime": "2018-08-24 20:50:00",
    "Period": 300,
    "MetricName": "CPUUsage",
    "DataPoints": [
      {
        "Dimensions": [
          {
            "Name": "InstanceId",
            "Value": "ins-j0hk02zo"
          }
        ],
        "Timestamps": [
          1535079000,
          1535079300,
          1535079600,
          1535079900,
          1535080200,
          1535080500
        ],
        "Values": [
          2.566,
          2.283,
          6.316,
          2.816,
          2.7,
          2.35
        ]
      }
    ],
    "RequestId": "d96ec542-6547-4af2-91ac-fee85c1b8b85"
  }
}

Example2 Getting the Monitoring Data of Multiple CVM Instances

This API is used to get the 5-minute CPU utilization monitoring data of multiple CVM instances in a certain period of time.

Input Example

https://monitor.tencentcloudapi.com/?Action=GetMonitorData
&Namespace=QCE/CVM
&MetricName=CPUUsage
&Period=300
&StartTime=2018-09-22T19:51:23+08:00
&EndTime=2018-09-22T20:51:23+08:00
&Instances.0.Dimensions.0.Name=InstanceId
&Instances.0.Dimensions.0.Value=ins-j0hk02zo
&Instances.1.Dimensions.0.Name=InstanceId
&Instances.1.Dimensions.0.Value=ins-o8vv2w10
&<Common request parameter>

Output Example

{
  "Response": {
    "StartTime": "2018-09-22 19:50:00",
    "EndTime": "2018-09-22 20:50:00",
    "Period": 300,
    "MetricName": "CPUUsage",
    "DataPoints": [
      {
        "Dimensions": [
          {
            "Name": "InstanceId",
            "Value": "ins-j0hk02zo"
          }
        ],
        "Timestamps": [],
        "Values": []
      },
      {
        "Dimensions": [
          {
            "Name": "InstanceId",
            "Value": "ins-o8vv2w10"
          }
        ],
        "Timestamps": [],
        "Values": []
      }
    ],
    "RequestId": "9ac53ccc-fbab-483d-980b-b763bcc2f83f"
  }
}

Example3 Getting the Monitoring Data of a TencentDB Instance

This API is used to get the 5-minute CPU utilization monitoring data of a TencentDB instance in a certain period of time.

Input Example

https://monitor.tencentcloudapi.com/?Action=GetMonitorData
&Namespace=QCE/CDB
&MetricName=SlowQueries
&Period=300&StartTime=2018-09-22T19:23:07+08:00
&EndTime=2018-09-22T20:23:07+08:00
&Instances.0.Dimensions.0.Name=InstanceId
&Instances.0.Dimensions.0.Value=cdb-k5d6z7p0
&Instances.0.Dimensions.1.Name=InstanceType
&Instances.0.Dimensions.1.Value=2
&<Common request parameter>

Output Example

{
  "Response": {
    "StartTime": "2018-09-22 19:20:00",
    "EndTime": "2018-09-22 20:20:00",
    "Period": 300,
    "MetricName": "SlowQueries",
    "DataPoints": [
      {
        "Dimensions": [
          {
            "Name": "InstanceType",
            "Value": "2"
          },
          {
            "Name": "InstanceId",
            "Value": "cdb-k5d6z7p0"
          }
        ],
        "Timestamps": [],
        "Values": []
      }
    ],
    "RequestId": "2bcfe8b7-8ea8-4488-9d17-f1aeb106eecd"
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error.
InvalidParameterValue Invalid parameter value.