VPC - NAT Gateway Monitoring API

Last updated: 2020-05-14 17:05:47

1. API Description

API: GetMonitorData
API domain name: 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, and monitoring metric.

API call rate limit: 20 calls/second (1,200 calls/minute). A single request can get the data of up to 10 instances and up to 1,440 data points.

This API may fail due to the rate limit if you need to call a lot of metrics and objects. We recommend that you spread the call requests over time.

To query the monitoring data of a NAT gateway in a VPC, use the following input parameter values:
&Namespace=QCE/NAT_GATEWAY
&Instances.N.Dimensions.0.Name=natId
&Instances.N.Dimensions.0.Value=NAT gateway ID

2. Input Parameters

The list below contains only API request parameters and certain common parameters. Common request parameters need to be added when a call is made. For more information, please see Common Params.

2.1. Input parameters

2.1.1. Overview of input parameters

Parameter Name Required Type Description
Action Yes String Common parameter. Value for this API: GetMonitorData
Version Yes String Common parameter. Value for this API: 2018-07-24
Region No String Common parameter, indicating the region of the instance whose monitoring data is queried. For supported regions, please see the region list supported by CVM
Namespace Yes String Namespace. Each Tencent Cloud product has a namespace, such as NAT_GATEWAY, which must be capitalized for API 3.0
MetricName Yes String Metric name. For more information, please see section 2.2
Instances.N Yes Array of Instance Combination of instance object dimensions
Period No Integer Statistical period for monitoring data in seconds. Default value: 300
StartTime No Datetime Start time, such as "2016-01-01 10:25:00". Default value: "00:00:00" on the current day
EndTime No Timestamp End time, which is the current time by default. EndTime cannot be earlier than StartTime

2.1.2. Overview of parameters in each dimension

Parameter Name Dimension Name Dimension Description Format
Instances.N.Dimensions.0.Name natId NAT gateway ID String-type dimension name: natId
Instances.N.Dimensions.0.Value natId Specific NAT gateway ID Specific natId, such as nat-4d545d

2.2. Metric name

The statistical granularity (Period) and dimension (dimension) vary by metric. The DescribeBaseMetrics API can be used to get the periods and dimensions supported by each metric.

Metric Name Description Unit Dimension
Outbandwidth Public network outbound bandwidth Mbps natId
Inbandwidth Public network inbound bandwidth Mbps natId
Outpkg Outbound packets Packets/sec natId
Inpkg Inbound packets Packets/sec natId
Conns Connections Connections/sec natId

3. Output Parameters

Parameter Name Type Description
MetricName String Monitoring metric
StartTime Timestamp Data point start time
EndTime Timestamp Data point end time
Period Integer Statistical period
DataPoints Array of PointsObject Monitoring data list
RequestId String Unique request ID. Each request returns a unique ID. The RequestId is required to troubleshoot issues

4. Error Codes

Error Code Error Description Error Message
-502 The resource does not exist OperationDenied.SourceNotExists
-503 Incorrect request parameter InvalidParameter
-505 Missing parameter InvalidParameter.MissingParameter
-507 Limit exceeded OperationDenied.ExceedLimit
-509 Incorrect dimension combination InvalidParameter.DimensionGroupError
-513 Database operation failed InternalError.DBoperationFail

5. Samples

Sample 1

This example shows you how to get the monitoring data for public network outbound bandwidth of one NAT gateway in a VPC at 60-second statistical period during a certain period of time.

Input sample code

https://monitor.tencentcloudapi.com/?Action=GetMonitorData
&Namespace=QCE/NAT_GATEWAY
&MetricName=Outbandwidth
&Period=60
&StartTime=2019-05-08T16:40:00+08:00
&EndTime=2018-05-08T16:45:00+08:00
&Instances.0.Dimensions.0.Name=natId
&Instances.0.Dimensions.0.Value=nat-gwqe1234
&<Common request parameters>

Output sample code

{
  "Response": {
    "StartTime": "2019-05-08 16:40:00",
    "EndTime": "2019-05-08 16:45:00",
    "Period": 60,
    "MetricName": "Conns",
    "DataPoints": [
      {
        "Dimensions": [
          {
            "Name": "natId",
            "Value": "nat-gwqe1234"
          }
        ],
        "Timestamps": [
          1557304800,
          1557304860,
          1557304920,
          1557304980,
          1557305040,
          1557305100
        ],
        "Values": [
          0,
          0,
          0,
          0,
          0,
          0
        ]
      }
    ],
    "RequestId": "6e6ef1f3-c031-4359-855f-ccddcde3a7b1"
  }
}

Sample 2

This example shows you how to get the monitoring data for public network outbound bandwidth of multiple NAT gateways in a VPC at 60-second statistical period during a certain period of time.

Input sample code

https://monitor.tencentcloudapi.com/?Action=GetMonitorData
&Namespace=QCE/NAT_GATEWAY
&MetricName=Outbandwidth
&Period=60
&StartTime=2019-05-08T16:40:00+08:00
&EndTime=2018-05-08T16:45:00+08:00
&Instances.0.Dimensions.0.Name=natId
&Instances.0.Dimensions.0.Value=nat-gwqe1234
&Instances.1.Dimensions.0.Name=natId
&Instances.1.Dimensions.0.Value=nat-gwqe12345
&<Common request parameters>

Output sample code

{
  "Response": {
    "StartTime": "2019-05-08 16:40:00",
    "EndTime": "2019-05-08 16:45:00",
    "Period": 60,
    "MetricName": "Conns",
    "DataPoints": [
      {
        "Dimensions": [
          {
            "Name": "natId",
            "Value": "nat-gwqe1234"
          }
        ],
        "Timestamps": [
          1557304800,
          1557304860,
          1557304920,
          1557304980,
          1557305040,
          1557305100
        ],
        "Values": [
          0,
          0,
          0,
          0,
          0,
          0
        ]
      },
      {
        "Dimensions": [
          {
            "Name": "natId",
            "Value": "nat-gwqe12345"
          }
        ],
        "Timestamps": [
          1557304800,
          1557304860,
          1557304920,
          1557304980,
          1557305040,
          1557305100
        ],
        "Values": [
          0,
          0,
          0,
          0,
          0,
          0
        ]
      }
    ],
    "RequestId": "6e6ef1f3-c031-4359-855f-ccddcde3a7b1"
  }
}