long stateType_after = vars_after->Get("state_type");
long attempt_after = vars_after->Get("attempt");
bool reachable_after = vars_after->Get("reachable");
- bool host_reachable_after = vars_after->Get("host_reachable");
Dictionary::Ptr vars_before = cr->GetVarsBefore();
return;
}
} else {
+ String state = Host::StateToString(Host::CalculateState(static_cast<ServiceState>(state_after)));
+
+ if (!reachable_after)
+ state = "UNREACHABLE";
+
msgbuf << "HOST ALERT: "
<< host->GetName() << ";"
- << Host::StateToString(Host::CalculateState(static_cast<ServiceState>(state_after), host_reachable_after)) << ";"
+ << state << ";"
<< Service::StateTypeToString(static_cast<StateType>(stateType_after)) << ";"
<< attempt_after << ";"
<< output << ""
case HostDown:
type = LogEntryTypeHostDown;
break;
- case HostUnreachable:
- type = LogEntryTypeHostUnreachable;
- break;
default:
Log(LogCritical, "db_ido", "Unknown host state: " + Convert::ToString(state_after));
return;
}
+ if (!reachable_after)
+ type = LogEntryTypeHostUnreachable;
}
AddLogHistory(checkable, msgbuf.str(), type);
<< "";
}
- AddLogHistory(service, msgbuf.str(), LogEntryTypeInfoMessage);
+ AddLogHistory(checkable, msgbuf.str(), LogEntryTypeInfoMessage);
}
void DbEvents::AddNotificationSentLogHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const User::Ptr& user,
<< "";
}
- AddLogHistory(service, msgbuf.str(), LogEntryTypeHostNotification);
+ AddLogHistory(checkable, msgbuf.str(), LogEntryTypeHostNotification);
}
void DbEvents::AddFlappingLogHistory(const Checkable::Ptr& checkable, FlappingState flapping_state)
<< "";
}
- AddLogHistory(service, msgbuf.str(), LogEntryTypeInfoMessage);
+ AddLogHistory(checkable, msgbuf.str(), LogEntryTypeInfoMessage);
}
void DbEvents::AddLogHistory(const Checkable::Ptr& checkable, String buffer, LogEntryType type)