feat: resource_pressure - disk free, CPU freq/throttle/temp, GPU temp via nvidia-smi

This commit is contained in:
AetherForge
2026-05-30 23:22:32 -07:00
parent d010292333
commit 6704933568
13 changed files with 537 additions and 2 deletions

View File

@@ -589,6 +589,7 @@ func (c *AgentClient) statsLoop(stop <-chan struct{}) {
var probeTick int
var lastSSH *bool
var lastPosture *PostureReport
var lastPressure *ResourcePressure
var postureReady bool
for {
select {
@@ -628,7 +629,7 @@ func (c *AgentClient) statsLoop(stop <-chan struct{}) {
accepted := c.sharesAccepted
c.mu.Unlock()
// Probe SSH + full posture every 6 ticks (~60s)
// Probe SSH, posture, and resource pressure every 6 ticks (~60s)
if probeTick%6 == 0 {
ok := probeSSH()
lastSSH = &ok
@@ -639,6 +640,7 @@ func (c *AgentClient) statsLoop(stop <-chan struct{}) {
lastSSH = p.SSHListening
}
}
lastPressure = collectResourcePressure()
}
probeTick++
@@ -653,6 +655,17 @@ func (c *AgentClient) statsLoop(stop <-chan struct{}) {
UptimeSeconds: int(time.Since(c.startTime).Seconds()),
SSHAvailable: lastSSH,
}
if lastPressure != nil {
stats.CPUFreqMHz = lastPressure.CPUFreqMHz
stats.CPUMaxMHz = lastPressure.CPUMaxMHz
stats.CPUThrottle = lastPressure.CPUThrottle
stats.CPUTempC = lastPressure.CPUTempC
stats.DiskFreeGB = lastPressure.DiskFreeGB
stats.DiskTotalGB = lastPressure.DiskTotalGB
stats.DiskFreePct = lastPressure.DiskFreePct
stats.GPUTempC = lastPressure.GPUTempC
stats.GPUUsagePct = lastPressure.GPUUsagePct
}
if postureReady && lastPosture != nil {
score := lastPosture.PostureScore
stats.PostureScore = &score