diff options
| author | Jeff Carr <[email protected]> | 2024-10-13 01:38:35 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-13 01:38:35 -0500 |
| commit | 268cec143ae544d8b6abed55b2f84570b51ea030 (patch) | |
| tree | 4f4acd6d0968c264ee7bc1f378c0b8e96a5c2208 /poll.go | |
| parent | 3739671503295cec358c16676a17a6ebfa87a575 (diff) | |
more accurate totals
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'poll.go')
| -rw-r--r-- | poll.go | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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) |
