diff options
| author | Jeff Carr <[email protected]> | 2024-10-27 02:29:45 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-27 02:29:45 -0500 |
| commit | d0767eb9843fcdb9ab0e73200d8a9516e28c200c (patch) | |
| tree | ca89594578c692211753e1d988c01c9aedcd3ba3 /poll.go | |
| parent | 5d1729f99ba8968900eaaaa38f74f327730fffd4 (diff) | |
validate stuff should be here
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'poll.go')
| -rw-r--r-- | poll.go | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -97,7 +97,7 @@ func clusterHealthy() (bool, string) { var total int var working int var failed int - var missing int + var missing []*pb.Droplet var unknown int var unknownList []string @@ -121,6 +121,7 @@ func clusterHealthy() (bool, string) { log.Info("BAD STATE", d.StartState, d.Hostname, hname, "CurrentState =", d.CurrentState, shell.FormatDuration(dur)) good = false failed += 1 + missing = append(missing, d) } else { dur := time.Since(d.LastPoll.AsTime()) // Calculate the elapsed time if dur > time.Minute { @@ -133,7 +134,7 @@ func clusterHealthy() (bool, string) { l := shell.FormatDuration(dur) if l == "" { log.Info("DUR IS EMPTY", dur) - missing += 1 + missing = append(missing, d) continue } working += 1 @@ -143,8 +144,8 @@ func clusterHealthy() (bool, string) { var summary string = "(" summary += fmt.Sprintf("total = %d ", total) summary += fmt.Sprintf("working = %d ", working) - if missing > 0 { - summary += fmt.Sprintf("missing = %d ", missing) + if len(missing) > 0 { + summary += fmt.Sprintf("missing = %d ", len(missing)) } if unknown > 0 { summary += fmt.Sprintf("unknown = %d ", unknown, unknownList) @@ -158,11 +159,14 @@ func clusterHealthy() (bool, string) { summary += "(killcount=" + fmt.Sprintf("%d", me.killcount) + ")" } last := time.Since(me.unstable) - if last > 133*time.Second { + if last > me.clusterStableDuration { // the cluster has not been stable for 10 seconds s := strings.TrimSpace(shell.FormatDuration(last)) summary += "(stable=" + s + ")" } + for _, d := range missing { + summary += fmt.Sprint("\nmissing droplet: ", d.Hostname, " current state ", d.CurrentState) + } if good { return good, "GOOD=true " + summary } |
