This commit is contained in:
20
main.go
20
main.go
@@ -304,6 +304,26 @@ func main() {
|
||||
possibleHosts = append(possibleHosts, e)
|
||||
}
|
||||
}
|
||||
log.Printf("After filtering there are %d events\n", len(possibleHosts))
|
||||
|
||||
// Its possible that the VM disconnected messages dont' relate to the host HA events that we found
|
||||
// If that is the case then we fall back to the most recent host failure message in our list
|
||||
if len(possibleHosts) == 0 {
|
||||
log.Printf("No corresponding VM disconnected messages, falling back to any applicable host that experienced a HA event.\n")
|
||||
// Search for host failures
|
||||
for _, hostEvent := range hostFailures {
|
||||
if hostEvent.CreatedTime.In(location).Before(vmRestartTime) || hostEvent.CreatedTime.In(location).Equal(vmRestartTime) {
|
||||
possibleHosts = append(possibleHosts, hostEvent)
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("Based on event times there were %d possible hosts this VM was running on\n", len(possibleHosts))
|
||||
|
||||
if len(possibleHosts) == 0 {
|
||||
log.Printf("No ESXi outage events happened before VM %s restart event at %s, skipping this event.\n", event.Vm.Name, vmRestartTime)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
disconnectedHost := disconnectedEvents[0]
|
||||
|
Reference in New Issue
Block a user