From a615602bf86bda51e89d97a517260254d24fcea9 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 3 Dec 2024 08:41:08 +1100 Subject: [PATCH 1/3] Update main.go extend HA host outage search duration --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 7dd4efc..1bb1a40 100644 --- a/main.go +++ b/main.go @@ -216,6 +216,7 @@ func main() { begin := flag.Duration("b", time.Hour, "Begin time") // default BeginTime is 1h ago end := flag.Duration("e", 0, "End time") fuzzyMinutes := flag.Int("fuzziness", 5, "Number of minutes to offset VM restart time when searching for related Host failure event") + unreachableMinutes := flag.Int("unreachable", 20, "Number of minutes to search for host HA events either side of a VM failure") flag.Parse() // Print logs to file @@ -293,8 +294,8 @@ func main() { // make sure that this event is within 10 minutes either side of the corresponding host failed event if hostFound { - unreachableStartComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * -10)) - unreachableEndComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * 10)) + unreachableStartComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * -1 * *unreachableMinutes)) + unreachableEndComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * *unreachableMinutes)) if haFailedTime.Before(unreachableEndComparison) && haFailedTime.After(unreachableStartComparison) { haUnreachableEvents = append(haUnreachableEvents, h) From a1e4649455c3bcb86a472d09fb4e69b061d99929 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 3 Dec 2024 09:15:19 +1100 Subject: [PATCH 2/3] Update main.go --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 1bb1a40..aa9c7bf 100644 --- a/main.go +++ b/main.go @@ -294,8 +294,8 @@ func main() { // make sure that this event is within 10 minutes either side of the corresponding host failed event if hostFound { - unreachableStartComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * -1 * *unreachableMinutes)) - unreachableEndComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * *unreachableMinutes)) + unreachableStartComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * -1 * int64(*unreachableMinutes))) + unreachableEndComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * int64(*unreachableMinutes))) if haFailedTime.Before(unreachableEndComparison) && haFailedTime.After(unreachableStartComparison) { haUnreachableEvents = append(haUnreachableEvents, h) From f86aefdca6f76a58b4ae5b9663dd5f32b69fc233 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 3 Dec 2024 10:23:07 +1100 Subject: [PATCH 3/3] Update main.go --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index aa9c7bf..c88ff16 100644 --- a/main.go +++ b/main.go @@ -278,7 +278,8 @@ func main() { // filter ha status changed messages for unreachable ones for _, h := range haStatusChanges { unreachableMessage := strings.Contains(strings.ToLower(h.FullFormattedMessage), "changed to unreachable") - if unreachableMessage { + hostFailedMessage := strings.Contains(strings.ToLower(h.FullFormattedMessage), "changed to host failed") + if unreachableMessage || hostFailedMessage { // make sure this host was in the host failures list hostFound := false