tencent cloud

Feedback

DescribeStatisticData

Last updated: 2023-03-22 17:00:01

1. API Description

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

This API is used to query monitoring data by dimension conditions.

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

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

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 Params. The value used for this API: DescribeStatisticData.
Version Yes String Common Params. The value used for this API: 2018-07-24.
Region No String Common Params. This parameter is not required for this API.
Module Yes String Module, whose value is fixed at monitor
Namespace Yes String Namespace. Valid values: QCE, TKE2.
MetricNames.N Yes Array of String Metric name list
Conditions.N No Array of MidQueryCondition Dimension condition. The = and in operators are supported
Period No Integer Statistical period in seconds. Default value: 300. Optional values: 60, 300, 3,600, and 86,400.
Due to the storage period limit, the statistical period is subject to the time range of statistics:
60s: The time range is less than 12 hours, and the timespan between StartTime and the current time cannot exceed 15 days.
300s: The time range is less than three days, and the timespan between StartTime and the current time cannot exceed 31 days.
3,600s: The time range is less than 30 days, and the timespan between StartTime and the current time cannot exceed 93 days.
86,400s: The time range is less than 186 days, and the timespan between StartTime and the current time cannot exceed 186 days.
StartTime No String Start time, which is the current time by default, such as 2020-12-08T19:51:23+08:00
EndTime No String End time, which is the current time by default, such as 2020-12-08T19:51:23+08:00
GroupBys.N No Array of String groupBy by the specified dimension

3. Output Parameters

Parameter Name Type Description
Period Integer Statistical period
StartTime String Start time
EndTime String End time
Data Array of MetricData Monitoring data
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Querying monitoring data by dimension condition

This example shows you how to query the monitoring data of the metric K8sPodCpuCoreUsed.

Input Example

POST / HTTP/1.1
Host: monitor.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeStatisticData
<Common request parameters>

{
    "Module": "monitor",
    "Namespace": "QCE/TKE2",
    "MetricNames": [
        "K8sPodCpuCoreUsed"
    ],
    "Period": 300,
    "Conditions": [
        {
            "Key": "tke_cluster_instance_id",
            "Operator": "=",
            "Value": [
                "cls-mw2w40s7"
            ]
        }
    ],
    "StartTime": "2020-11-24T15:15:50+08:00",
    "EndTime": "2020-11-24T15:25:50+08:00"
}

Output Example

{
    "Response": {
        "Data": [
            {
                "MetricName": "K8sPodCpuCoreUsed",
                "Points": [
                    {
                        "Dimensions": [
                            {
                                "Name": "tke_cluster_instance_id",
                                "Value": "cls-mw2w40s7"
                            },
                            {
                                "Name": "node",
                                "Value": "cls-gn7vut9a-virtual-kubelet-subnet-node-2"
                            },
                            {
                                "Name": "pod_name",
                                "Value": "proxy-edge-j7j95"
                            },
                            {
                                "Name": "workload_name",
                                "Value": "init-test-nfs02"
                            },
                            {
                                "Name": "namespace",
                                "Value": "default-test"
                            },
                            {
                                "Name": "node_role",
                                "Value": "node"
                            },
                            {
                                "Name": "un_instance_id",
                                "Value": "cls-gn7vut9a-virtual-kubelet-subnet-nmpi5ecw-1"
                            },
                            {
                                "Name": "workload_kind",
                                "Value": "Deployment"
                            }
                        ],
                        "Values": [
                            {
                                "Timestamp": 1606202100,
                                "Value": 41.066
                            },
                            {
                                "Timestamp": 1606202400,
                                "Value": 38.666
                            },
                            {
                                "Timestamp": 1606202700,
                                "Value": 37.866
                            }
                        ]
                    },
                    {
                        "Dimensions": [
                            {
                                "Name": "namespace",
                                "Value": "default-test"
                            },
                            {
                                "Name": "node",
                                "Value": "cls-gn7vut9a-virtual-kubelet-subnet-node-3"
                            },
                            {
                                "Name": "node_role",
                                "Value": "node"
                            },
                            {
                                "Name": "pod_name",
                                "Value": "network-tools-b94d6dd89-flf7n"
                            },
                            {
                                "Name": "un_instance_id",
                                "Value": "cls-gn7vut9a-virtual-kubelet-subnet-nmpi5ecw-1"
                            },
                            {
                                "Name": "workload_kind",
                                "Value": "Deployment"
                            },
                            {
                                "Name": "workload_name",
                                "Value": "init-test-nfs00"
                            },
                            {
                                "Name": "tke_cluster_instance_id",
                                "Value": "cls-mw2w40s7"
                            }
                        ],
                        "Values": [
                            {
                                "Timestamp": 1606202100,
                                "Value": 42.666
                            },
                            {
                                "Timestamp": 1606202400,
                                "Value": 33.6
                            },
                            {
                                "Timestamp": 1606202700,
                                "Value": 40.266
                            }
                        ]
                    }
                ]
            }
        ],
        "EndTime": "2020-11-24 15:25:00",
        "Period": 300,
        "RequestId": "0d25d659-71ee-4c93-b8e1-f3992c61ff46",
        "StartTime": "2020-11-24 15:15:00"
    }
}

5. Developer Resources

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
AuthFailure Error with CAM signature/authentication.
AuthFailure.UnauthorizedOperation The request is not authorized. For more information on the authentication, see the CAM documentation.
FailedOperation Operation failed.
FailedOperation.DataColumnNotFound The data table field doesn't exist.
FailedOperation.DataQueryFailed Failed to query the data.
FailedOperation.DataTableNotFound The data table doesn't exist.
FailedOperation.DbQueryFailed Failed to query the database.
FailedOperation.DbRecordCreateFailed Failed to create the database record.
FailedOperation.DbRecordDeleteFailed Failed to delete the database record.
FailedOperation.DbRecordUpdateFailed Failed to update the database record.
FailedOperation.DbTransactionBeginFailed Failed to start the database transaction.
FailedOperation.DbTransactionCommitFailed Failed to submit the database transaction.
FailedOperation.DimQueryRequestFailed Failed to query the service in the request dimension.
FailedOperation.DivisionByZero The dividend is zero.
InternalError Internal error.
InternalError.CallbackFail Error with the callback.
InternalError.DependsApi Error with another dependent API.
InternalError.DependsDb Error with the dependent db.
InternalError.DependsMq Error with the dependent mq.
InternalError.ExeTimeout Execution timed out.
InternalError.System System error.
InternalError.TaskResultFormat An error occurred while parsing the task result.
InvalidParameter Invalid parameter.
InvalidParameter.DupTask The task has already been submitted.
InvalidParameter.InvalidParameter Invalid parameter.
InvalidParameter.InvalidParameterParam Invalid parameter.
InvalidParameter.MissAKSK The platform configuration is missing.
InvalidParameter.ParamError Incorrect parameter.
InvalidParameter.SecretIdOrSecretKeyError Error with the platform configuration.
InvalidParameter.UnsupportedProduct This product doesn't support scan.
InvalidParameterValue The parameter value is incorrect.
InvalidParameterValue.DashboardNameExists The dashboard name already exists.
InvalidParameterValue.VersionMismatch The version does not match.
LimitExceeded Quota limit is reached.
LimitExceeded.MetricQuotaExceeded Quota limit on metrics is reached. Requests containing unregistered metrics are prohibited.
MissingParameter Missing parameter.
OperationDenied Operation denied.
RequestLimitExceeded The number of requests exceeds the frequency limit.
ResourceInUse The resource is in use.
ResourceInsufficient Insufficient resources.
ResourceNotFound The resource is not found.
ResourceNotFound.NotExistTask The task does not exist.
UnauthorizedOperation Unauthorized operation.
UnknownParameter Unknown parameter.
UnsupportedOperation Unsupported operation.
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