DB IDO: Add 'is_reachable' column to {host,service}status tables.

Refs #6094
This commit is contained in:
Michael Friedrich 2014-05-10 21:03:47 +02:00
parent 97d51c4269
commit f5e568d3fb
8 changed files with 28 additions and 0 deletions

View File

@ -747,6 +747,7 @@ CREATE TABLE IF NOT EXISTS icinga_hoststatus (
normal_check_interval double default '0',
retry_check_interval double default '0',
check_timeperiod_object_id bigint unsigned default 0,
is_reachable smallint default 0,
PRIMARY KEY (hoststatus_id),
UNIQUE KEY object_id (host_object_id)
) ENGINE=InnoDB COMMENT='Current host status information';
@ -1230,6 +1231,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicestatus (
normal_check_interval double default '0',
retry_check_interval double default '0',
check_timeperiod_object_id bigint unsigned default 0,
is_reachable smallint default 0,
PRIMARY KEY (servicestatus_id),
UNIQUE KEY object_id (service_object_id)
) ENGINE=InnoDB COMMENT='Current service status information';

View File

@ -0,0 +1,8 @@
-- -----------------------------------------
-- #6094
-- -----------------------------------------
ALTER TABLE icinga_hoststatus ADD COLUMN is_reachable smallint(6) DEFAULT NULL;
ALTER TABLE icinga_servicestatus ADD COLUMN is_reachable smallint(6) DEFAULT NULL;

View File

@ -773,6 +773,7 @@ CREATE TABLE icinga_hoststatus (
normal_check_interval double precision default 0,
retry_check_interval double precision default 0,
check_timeperiod_object_id bigint default 0,
is_reachable INTEGER default 0,
CONSTRAINT PK_hoststatus_id PRIMARY KEY (hoststatus_id) ,
CONSTRAINT UQ_hoststatus UNIQUE (host_object_id)
) ;
@ -1256,6 +1257,7 @@ CREATE TABLE icinga_servicestatus (
normal_check_interval double precision default 0,
retry_check_interval double precision default 0,
check_timeperiod_object_id bigint default 0,
is_reachable INTEGER default 0,
CONSTRAINT PK_servicestatus_id PRIMARY KEY (servicestatus_id) ,
CONSTRAINT UQ_servicestatus UNIQUE (service_object_id)
) ;

View File

@ -0,0 +1,8 @@
-- -----------------------------------------
-- #6094
-- -----------------------------------------
ALTER TABLE icinga_hoststatus ADD COLUMN is_reachable INTEGER default 0;
ALTER TABLE icinga_servicestatus ADD COLUMN is_reachable INTEGER default 0;

View File

@ -167,6 +167,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const
fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(host));
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(host));
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(host));
return fields;
}

View File

@ -161,6 +161,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(service));
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
fields->Set("modified_service_attributes", service->GetModifiedAttributes());
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(service));
return fields;
}

View File

@ -216,6 +216,11 @@ int CompatUtility::GetCheckableIsFlapping(const Checkable::Ptr& checkable)
return (checkable->IsFlapping() ? 1 : 0);
}
int CompatUtility::GetCheckableIsReachable(const Checkable::Ptr& checkable)
{
return (checkable->IsReachable() ? 1 : 0);
}
String CompatUtility::GetCheckablePercentStateChange(const Checkable::Ptr& checkable)
{
return Convert::ToString(checkable->GetFlappingCurrent());

View File

@ -59,6 +59,7 @@ public:
static int GetCheckableEventHandlerEnabled(const Checkable::Ptr& checkable);
static int GetCheckableFlapDetectionEnabled(const Checkable::Ptr& checkable);
static int GetCheckableIsFlapping(const Checkable::Ptr& checkable);
static int GetCheckableIsReachable(const Checkable::Ptr& checkable);
static String GetCheckablePercentStateChange(const Checkable::Ptr& checkable);
static int GetCheckableProcessPerformanceData(const Checkable::Ptr& checkable);