Update main.go
All checks were successful
continuous-integration/drone/push Build is passing

extend HA host outage search duration
This commit is contained in:
2024-12-03 08:41:08 +11:00
parent 8dd6146818
commit a615602bf8

View File

@@ -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)