better poll hyper output

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-13 18:53:13 -06:00
parent 0697375d44
commit bd2ddb278c
1 changed files with 4 additions and 7 deletions

11
dump.go
View File

@ -6,6 +6,7 @@ import (
"time"
pb "go.wit.com/lib/protobuf/virtbuf"
"go.wit.com/log"
)
/*
@ -76,21 +77,17 @@ func dumpHypervisors(w http.ResponseWriter) {
var totalDroplets int
var totalUnknownDroplets int
for _, h := range me.hypers {
// lastpoll time.Time // the last time the hypervisor polled
dur := time.Since(h.lastpoll)
tmp := pb.FormatDuration(dur)
fmt.Fprintln(w, h.pb.Hostname, "killcount =", h.killcount, "lastpoll:", tmp)
for name, t := range h.lastDroplets {
dur := time.Since(t)
tmp := pb.FormatDuration(dur)
for name, _ := range h.lastDroplets {
totalDroplets += 1
d := me.cluster.FindDropletByName(name)
header := d.SprintDumpHeader() + " "
if d == nil {
totalUnknownDroplets += 1
fmt.Fprintln(w, "\t", h.pb.Hostname, "name =", name, "lastpoll:", tmp)
} else {
fmt.Fprintln(w, "\t", h.pb.Hostname, "name =", name, "lastpoll:", tmp, d.Current.State)
}
log.Info("\t", header, d.Hostname)
}
}
if totalUnknownDroplets == 0 {