---
title: "查询实例pmacct流量数据"
method: GET
path: "/user/instances/{instance_id}/pmacct/query"
tags: ["用户管理"]
---

# 查询实例pmacct流量数据

`GET /user/instances/{instance_id}/pmacct/query`

查询实例的pmacct流量数据

## Path parameters

- `instance_id` integer, required

## Response `200`

查询成功

- object
  - `code` integer
  - `data` MonitoringPmacctSummary
    - `all_time` MonitoringPmacctTrafficRecord
      - `created_at` string
      - `day` integer — 日期
      - `hour` integer — 小时
      - `id` integer
      - `instance_id` integer — 实例ID
      - `mapped_ip` string — 映射的公网IP地址
      - `minute` integer — 分钟（0, 5, 10, ..., 55）
      - `month` integer — 月份
      - `provider_id` integer — Provider ID
      - `provider_type` string — Provider类型
      - `record_time` string — 元数据
      - `rx_bytes` integer — 流量统计数据 (单位: 字节)
      - `timestamp` string — 时间维度（支持5分钟精度） year和month添加到复合索引中，提升月度查询性能 添加timestamp到复合索引以支持范围查询
      - `total_bytes` integer — 总流量字节数
      - `tx_bytes` integer — 发送字节数（出站流量）
      - `updated_at` string
      - `user_id` integer — 用户ID（冗余存储，避免JOIN）
      - `year` integer — 年份
    - `history` MonitoringPmacctTrafficRecord[] — 历史记录
      - `created_at` string
      - `day` integer — 日期
      - `hour` integer — 小时
      - `id` integer
      - `instance_id` integer — 实例ID
      - `mapped_ip` string — 映射的公网IP地址
      - `minute` integer — 分钟（0, 5, 10, ..., 55）
      - `month` integer — 月份
      - `provider_id` integer — Provider ID
      - `provider_type` string — Provider类型
      - `record_time` string — 元数据
      - `rx_bytes` integer — 流量统计数据 (单位: 字节)
      - `timestamp` string — 时间维度（支持5分钟精度） year和month添加到复合索引中，提升月度查询性能 添加timestamp到复合索引以支持范围查询
      - `total_bytes` integer — 总流量字节数
      - `tx_bytes` integer — 发送字节数（出站流量）
      - `updated_at` string
      - `user_id` integer — 用户ID（冗余存储，避免JOIN）
      - `year` integer — 年份
    - `instance_id` integer
    - `mapped_ip` string
    - `mapped_ipv6` string
    - `this_month` MonitoringPmacctTrafficRecord
      - `created_at` string
      - `day` integer — 日期
      - `hour` integer — 小时
      - `id` integer
      - `instance_id` integer — 实例ID
      - `mapped_ip` string — 映射的公网IP地址
      - `minute` integer — 分钟（0, 5, 10, ..., 55）
      - `month` integer — 月份
      - `provider_id` integer — Provider ID
      - `provider_type` string — Provider类型
      - `record_time` string — 元数据
      - `rx_bytes` integer — 流量统计数据 (单位: 字节)
      - `timestamp` string — 时间维度（支持5分钟精度） year和month添加到复合索引中，提升月度查询性能 添加timestamp到复合索引以支持范围查询
      - `total_bytes` integer — 总流量字节数
      - `tx_bytes` integer — 发送字节数（出站流量）
      - `updated_at` string
      - `user_id` integer — 用户ID（冗余存储，避免JOIN）
      - `year` integer — 年份
    - `today` MonitoringPmacctTrafficRecord
      - `created_at` string
      - `day` integer — 日期
      - `hour` integer — 小时
      - `id` integer
      - `instance_id` integer — 实例ID
      - `mapped_ip` string — 映射的公网IP地址
      - `minute` integer — 分钟（0, 5, 10, ..., 55）
      - `month` integer — 月份
      - `provider_id` integer — Provider ID
      - `provider_type` string — Provider类型
      - `record_time` string — 元数据
      - `rx_bytes` integer — 流量统计数据 (单位: 字节)
      - `timestamp` string — 时间维度（支持5分钟精度） year和month添加到复合索引中，提升月度查询性能 添加timestamp到复合索引以支持范围查询
      - `total_bytes` integer — 总流量字节数
      - `tx_bytes` integer — 发送字节数（出站流量）
      - `updated_at` string
      - `user_id` integer — 用户ID（冗余存储，避免JOIN）
      - `year` integer — 年份
  - `message` string
  - `msg` string

## Other responses

- `400` — 参数错误
- `401` — 用户未登录
- `403` — 无权限访问该实例
- `404` — 实例不存在
- `500` — 查询失败

---

[API](https://skmtc.net/oneclickvirt/apis/oneclickvirt-api.md) · [All operations](https://skmtc.net/oneclickvirt/apis/oneclickvirt-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/oneclickvirt/oneclickvirt-api/versions/1f98232296de/schema)
