跳到正文
Navigation

获取 CPU 使用率、核心数、各核使用率等信息

POST
https://your-panel.example.com:8888/system

获取 CPU 详细信息。调用 psutil.cpu_percent(percpu=True, interval=interval) 采样。

Request body application/x-www-form-urlencoded required

  • request_time
    string
    required

    Unix 时间戳。

  • request_token
    string
    required

    按 API 概览生成的签名。

  • action
    GetCpuInfo
    required

    具体操作名称。

Returns

default

接口响应,业务状态见下方详细说明。

JSON
  • 0
    optional
    number

    整体 CPU 使用率(%)

  • 1
    optional
    integer

    逻辑核心数

  • 2
    optional
    string

    各核心使用率数组

  • 3
    optional
    string

    CPU 型号名称

  • 4
    optional
    integer

    物理核心数

  • 5
    optional
    integer

    物理 CPU 数

各操作详细说明

GetCpuInfoaction=GetCpuInfo获取 CPU 使用率、核心数、各核使用率等信息

获取 CPU 详细信息。调用 psutil.cpu_percent(percpu=True, interval=interval) 采样。

  • 路由:POST /system
  • action:GetCpuInfo

输入参数

参数名称 必选 类型 描述
action 是 String 固定值 GetCpuInfo

采样间隔固定为 1 秒,不可通过 API 修改。

输出参数

返回数组 [使用率%, 逻辑核心数, [各核使用率...], CPU名称, 物理核心数, 物理CPU数]。

索引 类型 描述
0 Float 整体 CPU 使用率(%)
1 Integer 逻辑核心数
2 Array[Float] 各核心使用率数组
3 String CPU 型号名称
4 Integer 物理核心数
5 Integer 物理 CPU 数

示例

请求

POST /system HTTP/1.1
Content-Type: application/x-www-form-urlencoded

request_time=1700000000&request_token=xxx&action=GetCpuInfo

响应

[12.5, 2, [15.0, 10.0], "Intel Core Processor (Skylake, IBRS)", 1, 1]

Type to search…

↑↓ navigate↵ selectEsc close