summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-21 23:43:40 -0500
committerJeff Carr <[email protected]>2025-03-22 09:45:41 -0500
commitfc82e095ef933d152bc8a627ff6f67a8589c1c6f (patch)
tree7b514e6be9e007345498614033487db1a8543c7f
parentb5925dcdce2f91c23f522a6541f628a2be3e3ece (diff)
show virtigod for nowv0.0.50
-rw-r--r--exit.go22
-rw-r--r--http.go11
-rw-r--r--windowZood.go7
3 files changed, 35 insertions, 5 deletions
diff --git a/exit.go b/exit.go
new file mode 100644
index 0000000..204ae1f
--- /dev/null
+++ b/exit.go
@@ -0,0 +1,22 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+import (
+ "os"
+
+ "go.wit.com/log"
+)
+
+func okExit(thing string) {
+ if thing != "" {
+ log.Info("zookeeper exit:", thing, "ok")
+ }
+ os.Exit(0)
+}
+
+func badExit(err error) {
+ log.Info("zookeeper failed: ", err)
+ os.Exit(-1)
+}
diff --git a/http.go b/http.go
index cc19929..8eac404 100644
--- a/http.go
+++ b/http.go
@@ -86,12 +86,12 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
var bad int
for m := range me.machines.IterAll() {
count += 1
- if m.SinceLastUpdate() > 10*time.Minute {
- // skip machines that have not been updated in the last 10 minutes
- log.Info("ignoring old machine", m.Hostname)
- continue
- }
if findVersion(m, "zood") != me.zood.version {
+ if m.SinceLastUpdate() > 10*time.Minute {
+ // skip machines that have not been updated in the last 10 minutes
+ log.Info("ignoring old machine", m.Hostname)
+ continue
+ }
bad += 1
}
}
@@ -116,5 +116,6 @@ func startHTTP() {
err := http.ListenAndServe(p, nil)
if err != nil {
log.Println("Error starting server:", err)
+ badExit(err)
}
}
diff --git a/windowZood.go b/windowZood.go
index a2931dd..7a51703 100644
--- a/windowZood.go
+++ b/windowZood.go
@@ -132,6 +132,13 @@ func AddMachinesPB(tbox *gui.Node, pb *zoopb.Machines) *zoopb.MachinesTable {
t.AddStringFunc("zood", func(m *zoopb.Machine) string {
return findVersion(m, "zood")
})
+ t.AddStringFunc("virtigod", func(m *zoopb.Machine) string {
+ ver := findVersion(m, "virtigod")
+ if ver == "n/a" {
+ return ""
+ }
+ return ver
+ })
delf := func(m *zoopb.Machine) string {
return "delete"
}