add cli fuzziness option
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
3
main.go
3
main.go
@@ -214,6 +214,7 @@ func main() {
|
|||||||
vInsecure := flag.Bool("insecure", true, "Allow insecure connections to vCenter")
|
vInsecure := flag.Bool("insecure", true, "Allow insecure connections to vCenter")
|
||||||
begin := flag.Duration("b", time.Hour, "Begin time") // default BeginTime is 1h ago
|
begin := flag.Duration("b", time.Hour, "Begin time") // default BeginTime is 1h ago
|
||||||
end := flag.Duration("e", 0, "End time")
|
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()
|
flag.Parse()
|
||||||
|
|
||||||
// Print logs to file
|
// Print logs to file
|
||||||
@@ -281,7 +282,7 @@ func main() {
|
|||||||
vmRestartTime := event.CreatedTime.In(location)
|
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
|
// 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)
|
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
|
// Get a reference to the cluster mentioned
|
||||||
|
Reference in New Issue
Block a user