more accurate totals
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
3739671503
commit
268cec143a
13
poll.go
13
poll.go
|
@ -76,6 +76,9 @@ func clusterHealthy() (bool, string) {
|
|||
var total int
|
||||
var working int
|
||||
var failed int
|
||||
var missing int
|
||||
var unknown int
|
||||
|
||||
for _, d := range me.droplets {
|
||||
total += 1
|
||||
if d.State != "ON" {
|
||||
|
@ -84,6 +87,7 @@ 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)
|
||||
unknown += 1
|
||||
continue
|
||||
}
|
||||
if d.CurrentState != "ON" {
|
||||
|
@ -102,6 +106,7 @@ func clusterHealthy() (bool, string) {
|
|||
l := shell.FormatDuration(dur)
|
||||
if l == "" {
|
||||
log.Info("DUR IS EMPTY", dur)
|
||||
missing += 1
|
||||
continue
|
||||
}
|
||||
working += 1
|
||||
|
@ -110,8 +115,12 @@ func clusterHealthy() (bool, string) {
|
|||
}
|
||||
var summary string = "("
|
||||
summary += fmt.Sprintf("total = %d ", total)
|
||||
if working > 0 {
|
||||
summary += fmt.Sprintf("working = %d ", working)
|
||||
summary += fmt.Sprintf("working = %d ", working)
|
||||
if missing > 0 {
|
||||
summary += fmt.Sprintf("missing = %d ", missing)
|
||||
}
|
||||
if unknown > 0 {
|
||||
summary += fmt.Sprintf("unknown = %d ", unknown)
|
||||
}
|
||||
if failed > 0 {
|
||||
summary += fmt.Sprintf("failed = %d ", failed)
|
||||
|
|
Loading…
Reference in New Issue