From ffe754a96a68e7cf8905344073e3b1eedb78e94b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 13 Oct 2024 03:20:48 -0500 Subject: track the global killcount of virtigod restarts Signed-off-by: Jeff Carr --- event.go | 1 + poll.go | 1 + structs.go | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/event.go b/event.go index d554c78..c6e4bb5 100644 --- a/event.go +++ b/event.go @@ -20,4 +20,5 @@ func (h *HyperT) RestartDaemon() { dur := time.Since(h.lastpoll) // Calculate the elapsed time log.Info("KILLED DAEMON", h.Hostname, shell.FormatDuration(dur), "curl", url) + me.killcount += 1 } diff --git a/poll.go b/poll.go index 37a15ac..f7f2414 100644 --- a/poll.go +++ b/poll.go @@ -136,6 +136,7 @@ func clusterHealthy() (bool, string) { } summary = strings.TrimSpace(summary) summary += ")" + summary += "(killcount=" + fmt.Sprintf("%d", me.killcount) + ")" if good { return good, "GOOD=true " + summary } diff --git a/structs.go b/structs.go index de73e77..94d7ce5 100644 --- a/structs.go +++ b/structs.go @@ -16,9 +16,10 @@ func (b *virtigoT) Enable() { // this app's variables type virtigoT struct { - names []string - hypers []*HyperT - droplets []*DropletT + names []string + hypers []*HyperT + droplets []*DropletT + killcount int } // the stuff that is needed for a hypervisor -- cgit v1.2.3