tencent cloud


Using API to Pull Tencent Cloud Service Monitoring Data

Last updated: 2021-04-29 17:42:09

    This document describes how to use APIs to pull the monitoring data of Tencent Cloud services.

    API Overview

    Cloud Monitor provides the following two types of APIs for querying metric monitoring data

    API Operation Description
    DescribeBaseMetrics Queries the details of basic monitoring metric This API is used to query the types of basic monitoring metrics under the corresponding namespace
    GetMonitorData Pulls metric monitoring data This API is used to get the corresponding monitoring data of a metric in the object dimension

    API limits

    • The GetMonitorData API supports getting the monitoring data of a certain metric for all instances under an account in batches.
    • The GetMonitorData API can be called 20 times per second (1,200 times/minute) by default. A single request can get the data of up to 10 instances and up to 1,440 data points.
    • The retention period of monitoring data varies by monitoring granularity as detailed below:
      Monitoring Granularity Retention Period
      1 second 1 day
      1 minute 15 days
      5 minutes 31 days
      1 hour 93 days
      1 day 186 days


    The monitoring data of 1-minute metrics related to CPU, memory, and network for CVM is retained for 31 days.


    Preparing personal key

    1. Go to Manage API Key.
    2. If no key has been created, you need to click Create Key to create a key. If you have already created a key, you can click Display after SecretKey to get the key.

    Preparing Tencent Cloud service metric information

    This document takes the CVM CPU utilization metric as an example.

    1. Go to CVM Monitoring Metrics.
    2. Find the CPU utilization metric to view the CPU utilization metric name, dimension, statistical period, and other related information.


    This demo describes how to use the GetMonitorData API to query the CPU utilization of a CVM instance.

    1. Log in to API Explorer.
    2. Copy the prepared personal key into the corresponding SecretId and SecretKey text boxes.
    3. Find Region in the Input Parameters section and select the relevant region.
    4. Enter the prepared Tencent Cloud service information in the corresponding text boxes in the Input Parameters section.
    • Namespace: enter QCE/CVM.
    • MetricName: enter the name of the CPU utilization metric, i.e., CPUUsage.
    • Dimensions.N-Name: enter the supported dimension name, i.e., InstanceId.
    • Dimensions.N-Value: enter the corresponding InstanceId value (CVM instance ID), such as ins—12345678, which can be obtained through the DescribeInstances API of CVM.
    • Period: enter a statistical period supported by the metric, such as 300.
    • StartTime: enter the query start time in the format of 2020-12-20T19:51:23+08:00 (in the datetime_iso type).
    • EndTime: enter the query end time in the format of 2020-12-20T20:51:23+08:00 (in the datetime_iso type). EndTime cannot be earlier than StartTime.
    1. After completing the above information, you can copy the code in the corresponding language on the Code Generation tab to integrate the relevant monitoring data into your self-built monitoring system. You can also use Online Call to send a request to query the monitoring data online.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support