feat: init pc-monitor project
- Client: Go-based Windows hardware monitoring (CPU, GPU, memory, disk, network, power) - Server: Go + Gin + SQLite backend with REST API - Frontend: Vue 3 + Element Plus dashboard - Docker deployment support - Windows service installation script
This commit is contained in:
25
server/model/alert.go
Normal file
25
server/model/alert.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type AlertRule struct {
|
||||
ID string `json:"id"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Metric string `json:"metric"`
|
||||
Operator string `json:"operator"`
|
||||
Threshold float64 `json:"threshold"`
|
||||
Duration int `json:"duration"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type Alert struct {
|
||||
ID string `json:"id"`
|
||||
DeviceID string `json:"device_id"`
|
||||
RuleID string `json:"rule_id"`
|
||||
Metric string `json:"metric"`
|
||||
Value float64 `json:"value"`
|
||||
Message string `json:"message"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
|
||||
}
|
||||
13
server/model/device.go
Normal file
13
server/model/device.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Device struct {
|
||||
ID string `json:"id"`
|
||||
Hostname string `json:"hostname"`
|
||||
OS string `json:"os"`
|
||||
IP string `json:"ip"`
|
||||
RegisteredAt time.Time `json:"registered_at"`
|
||||
LastReportAt time.Time `json:"last_report_at"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
54
server/model/metrics.go
Normal file
54
server/model/metrics.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Metrics struct {
|
||||
DeviceID string `json:"device_id"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
|
||||
// CPU
|
||||
CPUUsage float64 `json:"cpu_usage"`
|
||||
CPUTemperature float64 `json:"cpu_temperature"`
|
||||
CPUCoreUsage []float64 `json:"cpu_core_usage"`
|
||||
|
||||
// Memory
|
||||
MemoryTotal uint64 `json:"memory_total"`
|
||||
MemoryUsed uint64 `json:"memory_used"`
|
||||
MemoryUsage float64 `json:"memory_usage"`
|
||||
|
||||
// GPU
|
||||
GPUUsage float64 `json:"gpu_usage"`
|
||||
GPUTemperature float64 `json:"gpu_temperature"`
|
||||
GPUMemoryTotal uint64 `json:"gpu_memory_total"`
|
||||
GPUMemoryUsed uint64 `json:"gpu_memory_used"`
|
||||
GPUName string `json:"gpu_name"`
|
||||
|
||||
// Network
|
||||
NetworkInterfaces []NetInterface `json:"network_interfaces"`
|
||||
|
||||
// Disk
|
||||
Disks []DiskInfo `json:"disks"`
|
||||
|
||||
// Power
|
||||
PowerStatus string `json:"power_status"`
|
||||
BatteryLevel int `json:"battery_level"`
|
||||
PowerSource string `json:"power_source"`
|
||||
}
|
||||
|
||||
type NetInterface struct {
|
||||
Name string `json:"name"`
|
||||
MACAddress string `json:"mac_address"`
|
||||
IPAddress string `json:"ip_address"`
|
||||
BytesSent uint64 `json:"bytes_sent"`
|
||||
BytesRecv uint64 `json:"bytes_recv"`
|
||||
Speed uint64 `json:"speed"`
|
||||
IsUp bool `json:"is_up"`
|
||||
}
|
||||
|
||||
type DiskInfo struct {
|
||||
MountPoint string `json:"mount_point"`
|
||||
Total uint64 `json:"total"`
|
||||
Used uint64 `json:"used"`
|
||||
Usage float64 `json:"usage"`
|
||||
FileSystem string `json:"file_system"`
|
||||
}
|
||||
Reference in New Issue
Block a user