mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-18 10:39:24 +08:00
- Deleted os_windows.go and process_windows.go, replacing them with platform-agnostic implementations in unit directory. - Removed Linux-specific process counting logic from process_linux.go and integrated it into unit. - Consolidated uptime and OS name retrieval into unit files for better organization. - Updated update mechanism to use global variables for current version and repository. - Introduced command-line flags for configuration, including disabling auto-update and web SSH. - Implemented WebSocket connection handling and terminal interaction for both Unix and Windows systems. - Added basic info upload functionality to server package, enhancing monitoring capabilities.
26 lines
395 B
Go
26 lines
395 B
Go
package monitoring
|
|
|
|
import (
|
|
"github.com/shirou/gopsutil/load"
|
|
)
|
|
|
|
type LoadInfo struct {
|
|
Load1 float64 `json:"load_1"`
|
|
Load5 float64 `json:"load_5"`
|
|
Load15 float64 `json:"load_15"`
|
|
}
|
|
|
|
func Load() LoadInfo {
|
|
|
|
avg, err := load.Avg()
|
|
if err != nil {
|
|
return LoadInfo{Load1: 0, Load5: 0, Load15: 0}
|
|
}
|
|
return LoadInfo{
|
|
Load1: avg.Load1,
|
|
Load5: avg.Load5,
|
|
Load15: avg.Load15,
|
|
}
|
|
|
|
}
|