diff options
Diffstat (limited to 'poll.go')
| -rw-r--r-- | poll.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -73,9 +73,11 @@ func findDroplet(name string) *DropletT { // that is intended to be sent to an uptime monitor like Kuma func clusterHealthy() (bool, string) { var good bool = true + var total int var working int var failed int for _, d := range me.droplets { + total += 1 if d.State != "ON" { continue } @@ -87,6 +89,7 @@ func clusterHealthy() (bool, string) { if d.CurrentState != "ON" { log.Info("BAD STATE", d.State, d.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 { @@ -106,12 +109,14 @@ 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 failed > 0 { - summary += fmt.Sprintf("failed = %d", failed) + summary += fmt.Sprintf("failed = %d ", failed) } + summary = strings.TrimSpace(summary) summary += ")" if good { return good, "GOOD=true " + summary |
