文档
测试

设备状态信息接收

POST
/devices/<device_sn:str>/ws

接口描述

接收设备状态信息的上报接口,注意这是websocket链接

请求参数

application/json
参数名
类型
描述
必填
参数要求
jsonrpc
str
JSON-RPC协议版本,必须写为“2.0”
必填
2.0
method
str
请求方法,设为"device-status"
必填
device-status
params
dict
参数字典
必填
cpu_time
dict
cpu状态信息
必填
user
str
用户cpu时间
必填
system
str
系统cpu时间
必填
idle
str
空闲cpu时间
必填
io_wait
str
io等待cpu时间
必填
memory
dict
内存状态信息
必填
total
str
内存总大小
必填
free
str
空闲内存大小
必填
buff_cache
str
buff/cache总量(可能是两个值?不对再分开)
必填
disk
list[dict]
硬盘状态信息,每个元素均为以下定义
必填
name
str
分区名
必填
used
str
已使用大小
必填
total
str
总大小
必填
process
dict
进程信息
必填
total
int
总进程
必填
running
int
正在运行的进程
必填
pending
int
挂起进程
必填
stopped
int
已停止进程
必填
zombie
int
僵尸进程
必填
id
str
客户端标识id
必填

响应参数

application/json
参数名
类型
描述
必填
参数要求
jsonrpc
str
JSON-RPC协议版本,必须写为“2.0”
必填
2.0
result
dict
成功时返回的字典
可选
code
int
状态码
必填
200
error
dict
失败时返回的字典
可选
code
int
状态码
必填
message
str
错误的简短描述
必填
id
str
与请求时对应的客户端标识id
必填
与请求的客户端id一致