add machine_id

This commit is contained in:
boge
2025-03-18 15:56:00 +08:00
parent 58b470e95f
commit 6001907e8a
7 changed files with 286 additions and 27 deletions

View File

@@ -5,6 +5,7 @@ type CPUInfo struct {
ModelName string `json:"model_name"`
Cores int `json:"cores"`
Architecture string `json:"architecture"`
UUID string `json:"uuid"`
}
// MemoryInfo holds the memory information.
@@ -12,18 +13,22 @@ type MemoryInfo struct {
Total uint64 `json:"total"`
Free uint64 `json:"free"`
Available uint64 `json:"available"`
Used uint64 `json:"used"` // 已用内存
Buffers uint64 `json:"buffers"` // 缓冲区内存
Cached uint64 `json:"cached"` // 缓存内存
Shared uint64 `json:"shared"` // 共享内存
}
// DiskInfo holds the disk information similar to df -Th output.
type DiskInfo struct {
Device string `json:"device"` // 逻辑分区设备名称
Filesystem string `json:"filesystem"` // 逻辑分区
Type string `json:"type"` // 文件系统类型
Size uint64 `json:"size"` // 总大小
Used uint64 `json:"used"` // 已用空间
Available uint64 `json:"available"` // 可用空间
UsePercent string `json:"use_percent"` // 使用百分比
MountPoint string `json:"mountpoint"` // 挂载点
Device string `json:"device"` // 逻辑分区设备名称
Filesystem string `json:"filesystem"` // 逻辑分区
Type string `json:"type"` // 文件系统类型
Size uint64 `json:"size"` // 总大小
Used uint64 `json:"used"` // 已用空间
Available uint64 `json:"available"` // 可用空间
UsePercent string `json:"use_percent"` // 使用百分比
MountPoint string `json:"mount_point"`
PhysicalDevice string `json:"physical_device"` // 物理设备名称
PhysicalSize uint64 `json:"physical_size"` // 物理盘大小
}
@@ -43,8 +48,28 @@ type MotherboardInfo struct {
Serial string `json:"serial"`
}
type SystemInfo struct {
MachineID string `json:"machine_id"` // 唯一标识符
OS OSInfo `json:"os"` // 操作系统
KernelVersion string `json:"kernel_version"` // 内核版本
}
type OSInfo struct {
Name string `json:"name"`
Version string `json:"version"`
ID string `json:"id"`
IDLike string `json:"id_like"`
VersionID string `json:"version_id"`
PrettyName string `json:"pretty_name"`
HomeURL string `json:"home_url"`
SupportURL string `json:"support_url"`
BugReportURL string `json:"bug_report_url"`
PrivacyURL string `json:"privacy_url"`
}
// HostInfo 主机信息模型
type HostInfo struct {
SystemInfo SystemInfo `json:"system_info"`
CPUInfo CPUInfo `json:"cpu_info"`
DiskInfo []DiskInfo `json:"disk_info"`
MemoryInfo MemoryInfo `json:"memory_info"`