mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-31 01:24:19 +02:00
commit
909c353839
@ -394,7 +394,8 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
|
|||||||
"\t" "last_notification=" << CompatUtility::GetCheckableNotificationLastNotification(checkable) << "\n"
|
"\t" "last_notification=" << CompatUtility::GetCheckableNotificationLastNotification(checkable) << "\n"
|
||||||
"\t" "next_notification=" << CompatUtility::GetCheckableNotificationNextNotification(checkable) << "\n"
|
"\t" "next_notification=" << CompatUtility::GetCheckableNotificationNextNotification(checkable) << "\n"
|
||||||
"\t" "current_notification_number=" << CompatUtility::GetCheckableNotificationNotificationNumber(checkable) << "\n"
|
"\t" "current_notification_number=" << CompatUtility::GetCheckableNotificationNotificationNumber(checkable) << "\n"
|
||||||
"\t" "modified_attributes=" << checkable->GetModifiedAttributes() << "\n";
|
"\t" "modified_attributes=" << checkable->GetModifiedAttributes() << "\n"
|
||||||
|
"\t" "is_reachable=" << CompatUtility::GetCheckableIsReachable(checkable) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusDataWriter::DumpServiceStatus(std::ostream& fp, const Service::Ptr& service)
|
void StatusDataWriter::DumpServiceStatus(std::ostream& fp, const Service::Ptr& service)
|
||||||
|
@ -747,6 +747,7 @@ CREATE TABLE IF NOT EXISTS icinga_hoststatus (
|
|||||||
normal_check_interval double default '0',
|
normal_check_interval double default '0',
|
||||||
retry_check_interval double default '0',
|
retry_check_interval double default '0',
|
||||||
check_timeperiod_object_id bigint unsigned default 0,
|
check_timeperiod_object_id bigint unsigned default 0,
|
||||||
|
is_reachable smallint default 0,
|
||||||
PRIMARY KEY (hoststatus_id),
|
PRIMARY KEY (hoststatus_id),
|
||||||
UNIQUE KEY object_id (host_object_id)
|
UNIQUE KEY object_id (host_object_id)
|
||||||
) ENGINE=InnoDB COMMENT='Current host status information';
|
) ENGINE=InnoDB COMMENT='Current host status information';
|
||||||
@ -1230,6 +1231,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicestatus (
|
|||||||
normal_check_interval double default '0',
|
normal_check_interval double default '0',
|
||||||
retry_check_interval double default '0',
|
retry_check_interval double default '0',
|
||||||
check_timeperiod_object_id bigint unsigned default 0,
|
check_timeperiod_object_id bigint unsigned default 0,
|
||||||
|
is_reachable smallint default 0,
|
||||||
PRIMARY KEY (servicestatus_id),
|
PRIMARY KEY (servicestatus_id),
|
||||||
UNIQUE KEY object_id (service_object_id)
|
UNIQUE KEY object_id (service_object_id)
|
||||||
) ENGINE=InnoDB COMMENT='Current service status information';
|
) ENGINE=InnoDB COMMENT='Current service status information';
|
||||||
@ -1404,7 +1406,6 @@ 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_statehistory ADD COLUMN endpoint_object_id bigint default NULL;
|
||||||
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;
|
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;
|
||||||
|
|
||||||
ALTER TABLE icinga_hosts ADD COLUMN check_service_object_id bigint default NULL;
|
|
||||||
|
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
-- add index (delete)
|
-- add index (delete)
|
||||||
@ -1599,6 +1600,6 @@ CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, co
|
|||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
-- set dbversion
|
-- set dbversion
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.11.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.11.0', modify_time=NOW();
|
INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.11.3', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.11.3', modify_time=NOW();
|
||||||
|
|
||||||
|
|
||||||
|
13
components/db_ido_mysql/schema/upgrade/0.0.11.sql
Normal file
13
components/db_ido_mysql/schema/upgrade/0.0.11.sql
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------
|
||||||
|
-- #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;
|
||||||
|
|
||||||
|
-- -----------------------------------------
|
||||||
|
-- set dbversion
|
||||||
|
-- -----------------------------------------
|
||||||
|
INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.11.3', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.11.3', modify_time=NOW();
|
@ -773,6 +773,7 @@ CREATE TABLE icinga_hoststatus (
|
|||||||
normal_check_interval double precision default 0,
|
normal_check_interval double precision default 0,
|
||||||
retry_check_interval double precision default 0,
|
retry_check_interval double precision default 0,
|
||||||
check_timeperiod_object_id bigint default 0,
|
check_timeperiod_object_id bigint default 0,
|
||||||
|
is_reachable INTEGER default 0,
|
||||||
CONSTRAINT PK_hoststatus_id PRIMARY KEY (hoststatus_id) ,
|
CONSTRAINT PK_hoststatus_id PRIMARY KEY (hoststatus_id) ,
|
||||||
CONSTRAINT UQ_hoststatus UNIQUE (host_object_id)
|
CONSTRAINT UQ_hoststatus UNIQUE (host_object_id)
|
||||||
) ;
|
) ;
|
||||||
@ -1256,6 +1257,7 @@ CREATE TABLE icinga_servicestatus (
|
|||||||
normal_check_interval double precision default 0,
|
normal_check_interval double precision default 0,
|
||||||
retry_check_interval double precision default 0,
|
retry_check_interval double precision default 0,
|
||||||
check_timeperiod_object_id bigint default 0,
|
check_timeperiod_object_id bigint default 0,
|
||||||
|
is_reachable INTEGER default 0,
|
||||||
CONSTRAINT PK_servicestatus_id PRIMARY KEY (servicestatus_id) ,
|
CONSTRAINT PK_servicestatus_id PRIMARY KEY (servicestatus_id) ,
|
||||||
CONSTRAINT UQ_servicestatus UNIQUE (service_object_id)
|
CONSTRAINT UQ_servicestatus UNIQUE (service_object_id)
|
||||||
) ;
|
) ;
|
||||||
@ -1432,7 +1434,6 @@ 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_statehistory ADD COLUMN endpoint_object_id bigint default NULL;
|
||||||
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;
|
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;
|
||||||
|
|
||||||
ALTER TABLE icinga_hosts ADD COLUMN check_service_object_id bigint default NULL;
|
|
||||||
|
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
-- add index (delete)
|
-- add index (delete)
|
||||||
@ -1628,5 +1629,5 @@ CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, co
|
|||||||
-- set dbversion
|
-- set dbversion
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
|
|
||||||
SELECT updatedbversion('1.11.0');
|
SELECT updatedbversion('1.11.3');
|
||||||
|
|
||||||
|
14
components/db_ido_pgsql/schema/upgrade/0.0.11.sql
Normal file
14
components/db_ido_pgsql/schema/upgrade/0.0.11.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------
|
||||||
|
-- #6094
|
||||||
|
-- -----------------------------------------
|
||||||
|
|
||||||
|
ALTER TABLE icinga_hoststatus ADD COLUMN is_reachable INTEGER default 0;
|
||||||
|
ALTER TABLE icinga_servicestatus ADD COLUMN is_reachable INTEGER default 0;
|
||||||
|
|
||||||
|
-- -----------------------------------------
|
||||||
|
-- set dbversion
|
||||||
|
-- -----------------------------------------
|
||||||
|
|
||||||
|
SELECT updatedbversion('1.11.3');
|
@ -157,6 +157,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
|
|||||||
table->AddColumn(prefix + "services", Column(&HostsTable::ServicesAccessor, objectAccessor));
|
table->AddColumn(prefix + "services", Column(&HostsTable::ServicesAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "services_with_state", Column(&HostsTable::ServicesWithStateAccessor, objectAccessor));
|
table->AddColumn(prefix + "services_with_state", Column(&HostsTable::ServicesWithStateAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "services_with_info", Column(&HostsTable::ServicesWithInfoAccessor, objectAccessor));
|
table->AddColumn(prefix + "services_with_info", Column(&HostsTable::ServicesWithInfoAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "is_reachable", Column(&HostsTable::IsReachableAccessor, objectAccessor));
|
||||||
}
|
}
|
||||||
|
|
||||||
String HostsTable::GetName(void) const
|
String HostsTable::GetName(void) const
|
||||||
@ -1481,3 +1482,13 @@ Value HostsTable::ServicesWithInfoAccessor(const Value& row)
|
|||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value HostsTable::IsReachableAccessor(const Value& row)
|
||||||
|
{
|
||||||
|
Host::Ptr host = static_cast<Host::Ptr>(row);
|
||||||
|
|
||||||
|
if (!host)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
return host->IsReachable();
|
||||||
|
}
|
||||||
|
@ -140,6 +140,7 @@ protected:
|
|||||||
static Value ServicesAccessor(const Value& row);
|
static Value ServicesAccessor(const Value& row);
|
||||||
static Value ServicesWithStateAccessor(const Value& row);
|
static Value ServicesWithStateAccessor(const Value& row);
|
||||||
static Value ServicesWithInfoAccessor(const Value& row);
|
static Value ServicesWithInfoAccessor(const Value& row);
|
||||||
|
static Value IsReachableAccessor(const Value& row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ void ServicesTable::AddColumns(Table *table, const String& prefix,
|
|||||||
table->AddColumn(prefix + "groups", Column(&ServicesTable::GroupsAccessor, objectAccessor));
|
table->AddColumn(prefix + "groups", Column(&ServicesTable::GroupsAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "contact_groups", Column(&ServicesTable::ContactGroupsAccessor, objectAccessor));
|
table->AddColumn(prefix + "contact_groups", Column(&ServicesTable::ContactGroupsAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "check_source", Column(&ServicesTable::CheckSourceAccessor, objectAccessor));
|
table->AddColumn(prefix + "check_source", Column(&ServicesTable::CheckSourceAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "is_reachable", Column(&ServicesTable::IsReachableAccessor, objectAccessor));
|
||||||
|
|
||||||
HostsTable::AddColumns(table, "host_", boost::bind(&ServicesTable::HostAccessor, _1, objectAccessor));
|
HostsTable::AddColumns(table, "host_", boost::bind(&ServicesTable::HostAccessor, _1, objectAccessor));
|
||||||
}
|
}
|
||||||
@ -1167,4 +1168,12 @@ Value ServicesTable::CheckSourceAccessor(const Value& row)
|
|||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value ServicesTable::IsReachableAccessor(const Value& row)
|
||||||
|
{
|
||||||
|
Service::Ptr service = static_cast<Service::Ptr>(row);
|
||||||
|
|
||||||
|
if (!service)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
return service->IsReachable();
|
||||||
|
}
|
||||||
|
@ -124,6 +124,7 @@ protected:
|
|||||||
static Value GroupsAccessor(const Value& row);
|
static Value GroupsAccessor(const Value& row);
|
||||||
static Value ContactGroupsAccessor(const Value& row);
|
static Value ContactGroupsAccessor(const Value& row);
|
||||||
static Value CheckSourceAccessor(const Value& row);
|
static Value CheckSourceAccessor(const Value& row);
|
||||||
|
static Value IsReachableAccessor(const Value& row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -488,6 +488,8 @@ New columns:
|
|||||||
|
|
||||||
Table | Column
|
Table | Column
|
||||||
----------|--------------
|
----------|--------------
|
||||||
|
hosts | is_reachable
|
||||||
|
services | is_reachable
|
||||||
services | check_source
|
services | check_source
|
||||||
downtimes | triggers
|
downtimes | triggers
|
||||||
downtimes | trigger_time
|
downtimes | trigger_time
|
||||||
|
@ -167,6 +167,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const
|
|||||||
fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(host));
|
fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(host));
|
||||||
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(host));
|
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(host));
|
||||||
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
||||||
|
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(host));
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
|
|||||||
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(service));
|
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(service));
|
||||||
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
fields->Set("modified_service_attributes", service->GetModifiedAttributes());
|
fields->Set("modified_service_attributes", service->GetModifiedAttributes());
|
||||||
|
fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(service));
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -216,6 +216,11 @@ int CompatUtility::GetCheckableIsFlapping(const Checkable::Ptr& checkable)
|
|||||||
return (checkable->IsFlapping() ? 1 : 0);
|
return (checkable->IsFlapping() ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CompatUtility::GetCheckableIsReachable(const Checkable::Ptr& checkable)
|
||||||
|
{
|
||||||
|
return (checkable->IsReachable() ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
String CompatUtility::GetCheckablePercentStateChange(const Checkable::Ptr& checkable)
|
String CompatUtility::GetCheckablePercentStateChange(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
return Convert::ToString(checkable->GetFlappingCurrent());
|
return Convert::ToString(checkable->GetFlappingCurrent());
|
||||||
|
@ -59,6 +59,7 @@ public:
|
|||||||
static int GetCheckableEventHandlerEnabled(const Checkable::Ptr& checkable);
|
static int GetCheckableEventHandlerEnabled(const Checkable::Ptr& checkable);
|
||||||
static int GetCheckableFlapDetectionEnabled(const Checkable::Ptr& checkable);
|
static int GetCheckableFlapDetectionEnabled(const Checkable::Ptr& checkable);
|
||||||
static int GetCheckableIsFlapping(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 String GetCheckablePercentStateChange(const Checkable::Ptr& checkable);
|
||||||
static int GetCheckableProcessPerformanceData(const Checkable::Ptr& checkable);
|
static int GetCheckableProcessPerformanceData(const Checkable::Ptr& checkable);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
GET hosts
|
GET hosts
|
||||||
Columns: name last_state_change last_hard_state_change last_time_up last_time_down last_time_unreachable staleness
|
Columns: name last_state_change last_hard_state_change last_time_up last_time_down last_time_unreachable staleness is_reachable
|
||||||
ResponseHeader: fixed16
|
ResponseHeader: fixed16
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
GET services
|
GET services
|
||||||
Columns: description host_name last_state_change last_hard_state_change last_time_ok last_time_warning last_time_critical last_time_unknown staleness
|
Columns: description host_name last_state_change last_hard_state_change last_time_ok last_time_warning last_time_critical last_time_unknown staleness is_reachable
|
||||||
ResponseHeader: fixed16
|
ResponseHeader: fixed16
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user