diff options
Diffstat (limited to 'poll.go')
| -rw-r--r-- | poll.go | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -8,7 +8,7 @@ import ( "go.wit.com/log" ) -func (h HyperT) pollHypervisor() { +func (h *HyperT) pollHypervisor() { url := "http://" + h.Hostname + ":2520/vms" log.Log(POLL, "wget url =", url) s := shell.Wget(url) @@ -55,7 +55,7 @@ func (h HyperT) pollHypervisor() { log.Log(EVENT, name, "IS NEW. ADDED ON", h.Hostname) } } - // log.Info("i, s =", hostname, i, s) + h.lastpoll = time.Now() } func findDroplet(name string) *DropletT { @@ -74,6 +74,10 @@ func clusterHealthy() bool { continue } dur := time.Since(d.lastpoll) // Calculate the elapsed time + if d.CurrentState == "" { + // log.Info("SKIP. hostname has not been polled yet", d.Hostname, d.hname) + continue + } if d.CurrentState != "ON" { log.Info("BAD STATE", d.State, d.Hostname, d.hname, "CurrentState =", d.CurrentState, shell.FormatDuration(dur)) good = false @@ -84,13 +88,12 @@ func clusterHealthy() bool { good = false d.CurrentState = "MISSING" } - log.Info("GOOD STATE ON", d.Hostname, d.hname, shell.FormatDuration(dur)) + l := shell.FormatDuration(dur) + if l == "" { + log.Info("DUR IS EMPTY", dur) + } + // log.Info("GOOD STATE ON", d.Hostname, d.hname, "dur =", l) } } - if good { - log.Info("GOOD=true") - } else { - log.Info("GOOD=false") - } return good } |
