> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/zec/nat-gateway/describenatgatewaynewconnsmonitordata.md).

# DescribeNatGatewayNewConnsMonitorData

## 1. 接口描述

本接口(DescribeNatGatewayNewConnsMonitorData)用于查询一段时间的NAT网关每秒新建连接数（CPS，All/In/Out）监控数据。

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称         | 必选 | 类型                                                                                                                       | 描述                                                                                                                                                          |
| ------------ | -- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| natGatewayId | 是  | String                                                                                                                   | <p>NAT网关ID。</p><p>可通过调用 <a href="https://docs.console.zenlayer.com/api-reference/cn/zec/nat-gateway/describenatgateways.md">DescribeNatGateways</a> 获取。</p> |
| metricType   | 是  | [NatGatewayNewConnsMeta](https://docs.console.zenlayer.com/api-reference/cn/zec/datastructure.md#natgatewaynewconnsmeta) | 新建连接数监控指标类型。                                                                                                                                                |
| startTime    | 是  | String                                                                                                                   | <p>查询开始时间。</p><p>时间格式：yyyy-MM-ddTHH<span data-gb-custom-inline data-tag="emoji" data-code="1f1f2-1f1f2">🇲🇲</span>ssZ。</p>                                 |
| endTime      | 是  | String                                                                                                                   | <p>查询结束时间。</p><p>时间格式：yyyy-MM-ddTHH<span data-gb-custom-inline data-tag="emoji" data-code="1f1f2-1f1f2">🇲🇲</span>ssZ。</p>                                 |
| step         | 否  | Integer                                                                                                                  | <p>查询数据点间隔。</p><p>单位为分钟。</p><p>支持参数：1,5,15,60,360,1440,10080。</p><p>默认值：5</p>                                                                               |

## 3. 响应结果

| 参数名称        | 类型                                                                                                                    | 描述                                                       |
| ----------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| requestId   | String                                                                                                                | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| allMaxValue | Float                                                                                                                 | All（入+出之和）数据点的最大值。                                       |
| allMinValue | Float                                                                                                                 | All（入+出之和）数据点的最小值。                                       |
| allAvgValue | Float                                                                                                                 | All（入+出之和）数据点的平均值。                                       |
| inMaxValue  | Float                                                                                                                 | In（入方向）数据点的最大值。                                          |
| inMinValue  | Float                                                                                                                 | In（入方向）数据点的最小值。                                          |
| inAvgValue  | Float                                                                                                                 | In（入方向）数据点的平均值。                                          |
| outMaxValue | Float                                                                                                                 | Out（出方向）数据点的最大值。                                         |
| outMinValue | Float                                                                                                                 | Out（出方向）数据点的最小值。                                         |
| outAvgValue | Float                                                                                                                 | Out（出方向）数据点的平均值。                                         |
| dataList    | Array of [NatNewConnsValue](https://docs.console.zenlayer.com/api-reference/cn/zec/datastructure.md#natnewconnsvalue) | 监控数据集合。                                                  |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询NAT网关每秒新建连接数（CPS）监控指标。**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeNatGatewayNewConnsMonitorData
<Common Request Params>

Request：
{
    "natGatewayId": "<natGatewayId>",
    "metricType": "NEW_CONNECTIONS",
    "startTime": "2026-09-24T01:55:00Z",
    "endTime": "2026-09-24T07:55:00Z"
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "allMaxValue": 1.2,
    "allMinValue": 1.2,
    "allAvgValue": 1.2,
    "inMaxValue": 1.2,
    "inMinValue": 1.2,
    "inAvgValue": 1.2,
    "outMaxValue": 1.2,
    "outMinValue": 1.2,
    "outAvgValue": 1.2,
    "dataList": [
      {
        "time": "2026-09-24T01:55:00Z",
        "allValue": 1.2,
        "inValue": 1.2,
        "outValue": 1.2
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](https://docs.console.zenlayer.com/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](https://docs.console.zenlayer.com/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码                      | 说明         |
| ------- | ------------------------ | ---------- |
| 400     | INVALID\_TIME\_RANGE     | 查询时间范围不合法。 |
| 404     | INVALID\_NAT\_NOT\_FOUND | NAT网关不存在。  |
