磁盘结构
磁盘结构分运行时和静态两套。运行时描述当前容量和 IO,静态描述稳定元数据。
运行时:metrics.disk
{
"physical": [],
"logical": [],
"filesystems": [],
"base_io": [],
"smart": {
"status": "ok",
"updated_at": "2026-05-04T00:00:00Z",
"ttl_seconds": 300,
"devices": []
}
}
physical[]
每条对应一个块设备。
必填:
nameread_byteswrite_bytesread_rate_bytes_per_secwrite_rate_bytes_per_seciopsread_iopswrite_iopsutil_ratioqueue_lengthwait_msservice_ms
可选:
device_pathref
logical[]
逻辑存储容量视图。
必填:
kindnameusedfreeused_ratio
可选:
device_pathrefhealth
常见 kind:
diskraidraid_mdlvm_vglvm_thinpoollvm_lvzfs_pool
filesystems[]
挂载点视图。
必填:
pathusedfreeused_ratioinodes_usedinodes_freeinodes_used_ratio
可选:
devicemountpoint
base_io[]
用于展示和排序的 IO 视图。
必填:
kindnameread_rate_bytes_per_secwrite_rate_bytes_per_secread_iopswrite_iopsiops
可选:
device_pathrefread_byteswrite_bytesutil_ratioqueue_lengthwait_msservice_ms
logical 项可能没有累计字节、延迟或利用率字段。
smart
SMART 数据来自 root 侧缓存文件。它是运行时状态,不属于静态磁盘资产。
必填:
statusdevices[]
可选:
updated_atttl_seconds
devices[] 必填字段:
namesourcestatus
devices[] 可选字段:
refdevice_pathdevice_typeprotocolmodelserialwwnexit_statushealthtemp_cpower_on_hourslifetime_used_percentcritical_warningfailing_attrs[]
devices[] 为空时返回 []。不可用的 SMART 值省略。
critical_warning 是 NVMe 原始 critical warning bitset。failing_attrs[] 只包含当前失败的 ATA SMART 属性:
idnamewhen_failed
常见 status:
okpartialunsupportednot_foundno_permissiontimeouterrorno_cachestaleno_toolstandby
status 表示采集状态。health 表示磁盘健康结果。status=ok 且 health=failed 表示采集成功但磁盘健康失败。
no_cache、no_tool、unsupported 不表示磁盘故障。stale 表示缓存过期,但会保留最后一次 devices[]。
devices[].ref 只有在能安全匹配时才指向 physical[].ref 或 logical[].ref。
静态:disk
{
"physical": [],
"logical": [],
"filesystems": [],
"base_io": []
}
physical[]
name- 可选:
device_path - 可选:
ref
logical[]
kindname- 可选:
device_path - 可选:
ref - 可选:
total - 可选:
mountpoint - 可选:
fs_type - 可选:
devices[]
filesystems[]
pathtotalfs_typeinodes_total- 可选:
device - 可选:
mountpoint
base_io[]
kindname- 可选:
device_path - 可选:
ref - 可选:
role
平台行为
- Linux 采集文件系统、块设备、RAID、LVM、ZFS。
- 非 Linux 仍会从
gopsutil分区结果填充filesystems[]。 - 非 Linux RAID 固定返回
supported=false。 - 数组返回
[],不是null。