Merge pull request #7693 from Icinga/feature/icingadb-remove-unnecessar-service-host-ids

IcingaDB: Remove unnecessary service_/host_ids
This commit is contained in:
Alexander Aleksandrovič Klimov 2019-12-05 15:04:52 +01:00 committed by GitHub
commit 202e90b626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -981,11 +981,12 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
tie(host, service) = GetHostService(notification->GetCheckable());
attributes->Set("host_id", GetObjectIdentifier(host));
attributes->Set("command_id", GetObjectIdentifier(notification->GetCommand()));
if (service)
attributes->Set("service_id", GetObjectIdentifier(service));
else
attributes->Set("host_id", GetObjectIdentifier(host));
TimePeriod::Ptr timeperiod = notification->GetPeriod();
if (timeperiod)
@ -1019,11 +1020,9 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
if (service) {
attributes->Set("object_type", "service");
attributes->Set("service_id", GetObjectIdentifier(service));
attributes->Set("host_id", "00000000000000000000000000000000");
} else {
attributes->Set("object_type", "host");
attributes->Set("host_id", GetObjectIdentifier(host));
attributes->Set("service_id", "00000000000000000000000000000000");
}
auto expireTime (comment->GetExpireTime());
@ -1058,11 +1057,9 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
if (service) {
attributes->Set("object_type", "service");
attributes->Set("service_id", GetObjectIdentifier(service));
attributes->Set("host_id", "00000000000000000000000000000000");
} else {
attributes->Set("object_type", "host");
attributes->Set("host_id", GetObjectIdentifier(host));
attributes->Set("service_id", "00000000000000000000000000000000");
}
auto triggeredBy (Downtime::GetByName(downtime->GetTriggeredBy()));