init: 从 /root/zikai 根目录迁入
把原本散落在 /root/zikai 的 FastAPI 服务整理到 server/ 子目录, 开启独立 git 与 venv。运行时数据(config.yaml / keys / uploads) 按 .gitignore 留在工作目录但不入仓。
This commit is contained in:
31
app/schemas/system.py
Normal file
31
app/schemas/system.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""系统状态接口 DTO。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class MemoryUsage(BaseModel):
|
||||
total: int = Field(..., description="物理内存总量(字节)")
|
||||
available: int = Field(..., description="可用内存(字节)")
|
||||
used: int = Field(..., description="已用内存(字节)")
|
||||
percent: float = Field(..., description="使用率 0-100")
|
||||
|
||||
|
||||
class DiskUsage(BaseModel):
|
||||
device: str
|
||||
mountpoint: str
|
||||
fstype: str
|
||||
total: int
|
||||
used: int
|
||||
free: int
|
||||
percent: float
|
||||
|
||||
|
||||
class SystemStatus(BaseModel):
|
||||
hostname: str
|
||||
cpu_percent: float = Field(..., description="CPU 使用率(所有核平均)")
|
||||
cpu_count: int
|
||||
memory: MemoryUsage
|
||||
disks: list[DiskUsage]
|
||||
uptime_seconds: float
|
||||
Reference in New Issue
Block a user