add cli fuzziness option
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-06-16 08:41:23 +10:00
parent e11e39a604
commit 4a9693412e

View File

@@ -214,6 +214,7 @@ func main() {
vInsecure := flag.Bool("insecure", true, "Allow insecure connections to vCenter")
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")
flag.Parse()
// Print logs to file
@@ -281,7 +282,7 @@ func main() {
vmRestartTime := event.CreatedTime.In(location)
// Sometimes host HA events can come through a few minutes after a VM restart event, so create a "fuzzy" starting time to search for host HA events
fuzzyTime := vmRestartTime.Add(5 * time.Minute)
fuzzyTime := vmRestartTime.Add(time.Duration(int(time.Minute) * int(*fuzzyMinutes)))
log.Printf("Failure event for VM '%s' restarted in cluster '%s'\n", event.Vm.Name, event.ComputeResource.Name)
// Get a reference to the cluster mentioned