diff options
Diffstat (limited to 'poll.go')
| -rw-r--r-- | poll.go | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -10,7 +10,7 @@ import ( ) func (h *HyperT) pollHypervisor() { - url := "http://" + h.Hostname + ":2520/vms" + url := "http://" + h.pb.Hostname + ":2520/vms" log.Log(POLL, "wget url =", url) s := shell.Wget(url) if s == nil { @@ -30,26 +30,26 @@ func (h *HyperT) pollHypervisor() { state := fields[0] name := fields[1] if state == "ON" { - log.Log(POLL, h.Hostname, "STATE:", state, "HOST:", name, "rest:", fields[2:]) + log.Log(POLL, h.pb.Hostname, "STATE:", state, "HOST:", name, "rest:", fields[2:]) d := findDroplet(name) if d == nil { // this is a new unknown droplet (not in the config file) d = new(DropletT) - d.Hostname = name - d.hname = h.Hostname + d.pb.Hostname = name + d.hname = h.pb.Hostname d.lastpoll = time.Now() d.CurrentState = "ON" me.droplets = append(me.droplets, d) - log.Log(EVENT, name, "IS NEW. ADDED ON", h.Hostname) + log.Log(EVENT, name, "IS NEW. ADDED ON", h.pb.Hostname) } - log.Log(INFO, "ALREADY RECORDED", d.Hostname) + log.Log(INFO, "ALREADY RECORDED", d.pb.Hostname) // update the status to ON and the last polled value d.CurrentState = "ON" d.lastpoll = time.Now() // this means the droplet is still where it was before - if d.hname == h.Hostname { + if d.hname == h.pb.Hostname { continue } @@ -58,15 +58,15 @@ func (h *HyperT) pollHypervisor() { // but this is the first time it's shown up as running // this should mean a droplet is running where the config file says it probably should be running - if d.hyperPreferred == h.Hostname { - log.Log(EVENT, "new droplet", d.Hostname, "(matches config hypervisor", h.Hostname+")") - d.hname = h.Hostname + if d.hyperPreferred == h.pb.Hostname { + log.Log(EVENT, "new droplet", d.pb.Hostname, "(matches config hypervisor", h.pb.Hostname+")") + d.hname = h.pb.Hostname continue } - log.Log(EVENT, "new droplet", d.Hostname, "on", h.Hostname, "(in config file without preferred hypervisor)") + log.Log(EVENT, "new droplet", d.pb.Hostname, "on", h.pb.Hostname, "(in config file without preferred hypervisor)") } - d.hname = h.Hostname + d.hname = h.pb.Hostname } continue } @@ -76,7 +76,7 @@ func (h *HyperT) pollHypervisor() { func findDroplet(name string) *DropletT { for _, d := range me.droplets { - if d.Hostname == name { + if d.pb.Hostname == name { return d } } @@ -85,7 +85,7 @@ func findDroplet(name string) *DropletT { func findHypervisor(name string) *HyperT { for _, h := range me.hypers { - if h.Hostname == name { + if h.pb.Hostname == name { return h } } @@ -110,19 +110,19 @@ func clusterHealthy() (bool, string) { } 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) + // log.Info("SKIP. hostname has not been polled yet", d.pb.Hostname, d.hname) unknown += 1 - unknownList = append(unknownList, d.Hostname) + unknownList = append(unknownList, d.pb.Hostname) continue } if d.CurrentState != "ON" { - log.Info("BAD STATE", d.ConfigState, d.Hostname, d.hname, "CurrentState =", d.CurrentState, shell.FormatDuration(dur)) + log.Info("BAD STATE", d.ConfigState, d.pb.Hostname, d.hname, "CurrentState =", d.CurrentState, shell.FormatDuration(dur)) good = false failed += 1 } else { dur := time.Since(d.lastpoll) // Calculate the elapsed time if dur > time.Minute { - log.Info("GOOD STATE MISSING", d.Hostname, d.hname, shell.FormatDuration(dur)) + log.Info("GOOD STATE MISSING", d.pb.Hostname, d.hname, shell.FormatDuration(dur)) good = false d.CurrentState = "MISSING" failed += 1 @@ -135,7 +135,7 @@ func clusterHealthy() (bool, string) { continue } working += 1 - // log.Info("GOOD STATE ON", d.Hostname, d.hname, "dur =", l) + // log.Info("GOOD STATE ON", d.pb.Hostname, d.hname, "dur =", l) } } var summary string = "(" |
