DB IDO: Add check_source_object_id reference to endpoint objects.

Refs #5810
Refs #5636
This commit is contained in:
Michael Friedrich 2014-03-20 18:02:45 +01:00
parent b4f0148871
commit a26df23e3d
5 changed files with 32 additions and 2 deletions

View File

@ -1398,6 +1398,10 @@ ALTER TABLE icinga_servicechecks ADD COLUMN endpoint_object_id bigint default NU
ALTER TABLE icinga_statehistory ADD COLUMN endpoint_object_id bigint default NULL;
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;
ALTER TABLE icinga_servicestatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_hoststatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_statehistory ADD COLUMN check_source_object_id bigint default NULL;
-- -----------------------------------------
-- add index (delete)

View File

@ -0,0 +1,4 @@
ALTER TABLE icinga_servicestatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_hoststatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_statehistory ADD COLUMN check_source_object_id bigint default NULL;

View File

@ -1426,6 +1426,9 @@ ALTER TABLE icinga_servicechecks ADD COLUMN endpoint_object_id bigint default NU
ALTER TABLE icinga_statehistory ADD COLUMN endpoint_object_id bigint default NULL;
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;
ALTER TABLE icinga_servicestatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_hoststatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_statehistory ADD COLUMN check_source_object_id bigint default NULL;
-- -----------------------------------------
-- add index (delete)

View File

@ -0,0 +1,5 @@
ALTER TABLE icinga_servicestatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_hoststatus ADD COLUMN check_source_object_id bigint default NULL;
ALTER TABLE icinga_statehistory ADD COLUMN check_source_object_id bigint default NULL;

View File

@ -145,7 +145,14 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
fields->Set("output", CompatUtility::GetCheckResultOutput(cr));
fields->Set("long_output", CompatUtility::GetCheckResultLongOutput(cr));
fields->Set("perfdata", CompatUtility::GetCheckResultPerfdata(cr));
fields->Set("check_source", cr->GetCheckSource());
String check_source = cr->GetCheckSource();
fields->Set("check_source", check_source);
Endpoint::Ptr check_endpoint = Endpoint::GetByName(check_source);
if(check_endpoint)
fields->Set("check_source_object_id", check_endpoint);
}
fields->Set("current_state", CompatUtility::GetServiceCurrentState(service));
@ -887,7 +894,14 @@ void ServiceDbObject::AddStateChangeHistory(const Service::Ptr& service, const C
if (cr) {
fields1->Set("output", CompatUtility::GetCheckResultOutput(cr));
fields1->Set("long_output", CompatUtility::GetCheckResultLongOutput(cr));
fields1->Set("check_source", cr->GetCheckSource());
String check_source = cr->GetCheckSource();
fields1->Set("check_source", check_source);
Endpoint::Ptr check_endpoint = Endpoint::GetByName(check_source);
if(check_endpoint)
fields1->Set("check_source_object_id", check_endpoint);
}
fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */