Add universal forge, fusion disguise, remote deploy, and stability fixes.
Ship cross-platform spread kits and fusion ZIPs with per-OS launchers, one-liner dropper endpoints, Windows file disguise, and a large batch of wiring/bug fixes so agents connect reliably across a LAN test fleet.
This commit is contained in:
50
agent/stats/reporter_unix.go
Normal file
50
agent/stats/reporter_unix.go
Normal file
@@ -0,0 +1,50 @@
|
||||
//go:build !windows
|
||||
|
||||
package stats
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Reporter struct {
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func NewReporter() *Reporter {
|
||||
return &Reporter{}
|
||||
}
|
||||
|
||||
func (r *Reporter) SystemInfo() (hostname string, cpuCores int, memoryGB int) {
|
||||
hostname, _ = os.Hostname()
|
||||
cpuCores = runtime.NumCPU()
|
||||
total, _ := r.memoryStatus()
|
||||
memoryGB = int(total / (1024 * 1024 * 1024))
|
||||
if memoryGB < 1 {
|
||||
memoryGB = 1
|
||||
}
|
||||
return hostname, cpuCores, memoryGB
|
||||
}
|
||||
|
||||
func (r *Reporter) Usage() (cpuPct float64, memPct float64) {
|
||||
total, avail := r.memoryStatus()
|
||||
if total > 0 {
|
||||
memPct = float64(total-avail) / float64(total) * 100
|
||||
}
|
||||
return 0, memPct
|
||||
}
|
||||
|
||||
func (r *Reporter) FreeMemoryMB() uint64 {
|
||||
_, avail := r.memoryStatus()
|
||||
return avail / (1024 * 1024)
|
||||
}
|
||||
|
||||
func (r *Reporter) TotalMemoryMB() uint64 {
|
||||
total, _ := r.memoryStatus()
|
||||
return total / (1024 * 1024)
|
||||
}
|
||||
|
||||
func (r *Reporter) SystemCPUPercent() float64 {
|
||||
return 0
|
||||
}
|
||||
Reference in New Issue
Block a user