summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-13 00:57:29 -0500
committerJeff Carr <[email protected]>2024-10-13 00:57:29 -0500
commit7a4bc0b5d6fea7f8d036b36279564dc065e74301 (patch)
treeefe77a45fe34d13eaccd01ddd32efa993cde6e3f /http.go
parent62e9d8cfb1563ea7dbedf26a0dc593e4227cf413 (diff)
track hypervisor daemon kill count
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'http.go')
-rw-r--r--http.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/http.go b/http.go
index ebcaa70..85dc520 100644
--- a/http.go
+++ b/http.go
@@ -67,10 +67,20 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "GOOD=false")
}
for _, h := range me.hypers {
+ url := "http://" + h.Hostname + ":2520/kill"
dur := time.Since(h.lastpoll) // Calculate the elapsed time
- if dur > 2 * time.Minute {
- url := "http://" + h.Hostname + ":2520/kill"
+ if dur > 90 * time.Second {
log.Info("KILL DAEMON ON", h.Hostname, shell.FormatDuration(dur), "curl", url)
+ // s := shell.Wget(url)
+ // log.Info("curl got:", s)
+ h.lastpoll = time.Now()
+ h.killcount += 1
+ }
+ if h.killcount != 0 {
+ log.Info("KILL count =", h.killcount, "FOR", h.Hostname, dur, "curl", url)
+ }
+ if h.killcount > 10 {
+ log.Info("KILL count is greater than 10 for host", h.Hostname, dur, "curl", url)
}
// l := shell.FormatDuration(dur)
// log.Warn("HOST =", h.Hostname, "Last poll =", l)