IcingaDB#SendStatusUpdate(): avoid CheckResult::Ptr(nullptr)->GetCheckSource()

This commit is contained in:
Alexander A. Klimov 2019-11-25 17:15:47 +01:00
parent 287e4c3a8d
commit 407d6c0219
1 changed files with 5 additions and 1 deletions

View File

@ -1192,13 +1192,17 @@ void IcingaDB::SendStatusUpdate(const ConfigObject::Ptr& object, const CheckResu
"previous_hard_state", Convert::ToString(GetPreviousState(checkable, service, StateTypeHard)),
"output", Utility::ValidateUTF8(std::move(output.first)),
"long_output", Utility::ValidateUTF8(std::move(output.second)),
"check_source", cr->GetCheckSource(),
"max_check_attempts", Convert::ToString(checkable->GetMaxCheckAttempts()),
"event_time", Convert::ToString(TimestampToMilliseconds(cr ? cr->GetExecutionEnd() : Utility::GetTime())),
"event_id", Utility::NewUniqueID(),
"event_type", "state_change"
});
if (cr) {
xAdd.emplace_back("check_source");
xAdd.emplace_back(cr->GetCheckSource());
}
if (service) {
xAdd.emplace_back("object_type");
xAdd.emplace_back("service");