diff options
| author | Jeff Carr <[email protected]> | 2024-10-12 13:01:31 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-12 13:01:31 -0500 |
| commit | 58ff2a2412837b2e438e745ccf3ffc022d111458 (patch) | |
| tree | 460cb4e1f46b30db3dd4e17dec8fb4e2a23e8fd4 /poll.go | |
| parent | e94b4d6626fafb20da118eb8b17e661928c2b5da (diff) | |
state changes if droplet reboots
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'poll.go')
| -rw-r--r-- | poll.go | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -63,3 +63,31 @@ func findDroplet(name string) *DropletT { } return nil } + +func clusterHealthy() bool { + var good = true + for _, d := range me.droplets { + if d.State != "ON" { + continue + } + dur := time.Since(d.lastpoll) // Calculate the elapsed time + if d.CurrentState != "ON" { + log.Info("BAD STATE ", d.Hostname, "State =", d.State, "CurrentState =", d.CurrentState, shell.FormatDuration(dur)) + good = false + } 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)) + good = false + d.CurrentState = "MISSING" + } + log.Info("GOOD STATE ON", d.Hostname, d.hname, shell.FormatDuration(dur)) + } + } + if good { + log.Info("GOOD=true") + } else { + log.Info("GOOD=false") + } + return good +} |
