summaryrefslogtreecommitdiff
path: root/poll.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-13 01:38:35 -0500
committerJeff Carr <[email protected]>2024-10-13 01:38:35 -0500
commit268cec143ae544d8b6abed55b2f84570b51ea030 (patch)
tree4f4acd6d0968c264ee7bc1f378c0b8e96a5c2208 /poll.go
parent3739671503295cec358c16676a17a6ebfa87a575 (diff)
more accurate totals
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'poll.go')
-rw-r--r--poll.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/poll.go b/poll.go
index 8eeb624..b25e810 100644
--- a/poll.go
+++ b/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)