fleet-manager: host uptime metric + reboot-pending status
The manager lets an admin schedule a reboot (desired.reboot_at) but never showed whether it had happened. Add host uptime to the health snapshot and derive a reboot status from it. - proto: HealthSnapshot.uptime_seconds (15); regenerated pb.go (manager + agent copy). - agent: probe /proc/uptime -> uptime_seconds (with parser + test). - manager: Health.UptimeSeconds cached in inventory; snapshotToHealth maps it; influx writes + whitelists uptime_seconds as a queryable field. - UI: fmt.js dur() + rebootStatus() — boot_time = last_seen - uptime (manager clock frame, no host/manager sync needed), compared to reboot_at. Monitor host detail shows an "uptime" row and a "reboot" row: pending in X / overdue by X / rebooted. Observability-only — works before the reboot ACTUATOR lands (deferred). Once a host boots after the scheduled time (BMC/manual now, agent later), the badge flips to "rebooted" automatically.
This commit is contained in:
@@ -56,6 +56,18 @@ func TestParseMemUsedPct(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseUptime(t *testing.T) {
|
||||
if got := parseUptime([]byte("12345.67 98765.43\n")); got != 12345 {
|
||||
t.Fatalf("uptime = %d, want 12345", got)
|
||||
}
|
||||
if got := parseUptime([]byte("")); got != 0 {
|
||||
t.Fatalf("empty uptime = %d, want 0", got)
|
||||
}
|
||||
if got := parseUptime([]byte("garbage")); got != 0 {
|
||||
t.Fatalf("garbage uptime = %d, want 0", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseHandle(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
in string
|
||||
|
||||
Reference in New Issue
Block a user