filter ha unreachable to hosts that actually failed
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:
19
main.go
19
main.go
@@ -277,8 +277,23 @@ func main() {
|
||||
for _, h := range haStatusChanges {
|
||||
unreachableMessage := strings.Contains(strings.ToLower(h.FullFormattedMessage), "changed to unreachable")
|
||||
if unreachableMessage {
|
||||
haUnreachableEvents = append(haUnreachableEvents, h)
|
||||
log.Printf("Host %s unreachable HA status event at %s : '%s'\n", h.Host.Name, h.CreatedTime.In(location).Format(time.ANSIC), h.FullFormattedMessage)
|
||||
|
||||
// make sure this host was in the host failures list
|
||||
hostFound := false
|
||||
for _, f := range hostFailures {
|
||||
if h.Host.Name == f.Host.Name {
|
||||
// got it
|
||||
hostFound = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if hostFound {
|
||||
haUnreachableEvents = append(haUnreachableEvents, h)
|
||||
log.Printf("Host %s unreachable HA status event at %s : '%s'\n", h.Host.Name, h.CreatedTime.In(location).Format(time.ANSIC), h.FullFormattedMessage)
|
||||
} else {
|
||||
log.Printf("Host %s was not found in the list of hostfailure events, skipping this host\n", h.Host.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user