package models // CPUInfo 结构体用于存储 CPU 信息 type CPUInfo struct { ModelName string `json:"model_name"` Cores int `json:"cores"` Architecture string `json:"architecture"` Flags []string `json:"flags"` Hypervisor string `json:"hypervisor"` Virtualization string `json:"virtualization"` Frequency string `json:"frequency"` } // MemoryInfo holds the memory information. 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:"mount_point"` PhysicalDevice string `json:"physical_device"` // 物理设备名称 PhysicalSize uint64 `json:"physical_size"` // 物理盘大小 } // NetworkInterfaceInfo 结构体用于存储网卡信息 type NetworkInterfaceInfo struct { Name string `json:"name"` MACAddress string `json:"mac_address"` IPAddresses []string `json:"ip_addresses"` } // MotherboardInfo holds the motherboard information. type MotherboardInfo struct { Manufacturer string `json:"manufacturer"` Product string `json:"product"` Version string `json:"version"` Serial string `json:"serial"` } type SystemInfo struct { MachineID string `json:"machine_id"` // 主机唯一标识符 MachineSerial string `json:"machine_serial"` // 主机序列号 OS OSInfo `json:"os"` // 操作系统 KernelVersion string `json:"kernel_version"` // 内核版本 NodeName string `json:"node_name"` // 节点名称 NodeIP string `json:"node_ip"` // 节点IP } 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"` } // HostInfo 主机信息模型 type HostInfo struct { SystemInfo SystemInfo `json:"system_info"` CPUInfo CPUInfo `json:"cpu_info"` DiskInfo []DiskInfo `json:"disk_info"` MemoryInfo MemoryInfo `json:"memory_info"` NetInfo []NetworkInterfaceInfo `json:"net_info"` MotherboardInfo MotherboardInfo `json:"motherboard_info"` } // EnvInfo 环境信息 type EnvInfo struct { K8S_NAMESPACE string `json:"k8s_namespace"` // 环境名称 APPLICATION_NAME string `json:"application_name"` // 应用名称 CUST_JAVA_OPTS string `json:"cust_java_opts"` // 自定义java参数 BIZ_CONFIG_GROUP string `json:"biz_config_group"` // 业务配置组 SYS_CONFIG_GROUP string `json:"sys_config_group"` // 系统配置组 IMAGE_NAME string `json:"image_name"` // 镜像名称 JAVA_VERSION string `json:"java_version"` // java版本 GIT_COMMIT string `json:"git_commit"` // git commit GIT_BRANCH string `json:"git_branch"` // git branch NODE_NAME string `json:"node_name"` // 节点名称 NODE_IP string `json:"node_ip"` // 节点ip POD_NAME string `json:"pod_name"` // pod名称 LIMIT_CPU string `json:"limit_cpu"` // 限制cpu LIMIT_MEMORY string `json:"limit_memory"` // 限制内存 REQUEST_CPU string `json:"request_cpu"` // 请求cpu REQUEST_MEMORY string `json:"request_memory"` // 请求内存 } // HeartbeatRequest 心跳请求 type HeartbeatRequest struct { HostInfo HostInfo `json:"host_info"` // 主机信息 EnvInfo EnvInfo `json:"env_info"` // 环境信息 Timestamp int64 `json:"timestamp"` // 时间戳 TOTPCode string `json:"totp_code"` // TOTP验证码 } // HeartbeatResponse 心跳响应 type HeartbeatResponse struct { Authorized bool `json:"authorized"` // 是否已授权 TOTPCode string `json:"totp_code"` // TOTP验证码 Timestamp int64 `json:"timestamp"` // 时间戳 SecondTOTPSecret string `json:"second_totp_secret"` // 第二级的totp密钥 }