mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 05:34:48 +02:00
Make host 'check' attribute available in legacy interfaces.
Fixes #5764
This commit is contained in:
parent
c9590d5183
commit
23c47dd430
@ -207,8 +207,11 @@ void StatusDataWriter::DumpHostStatus(std::ostream& fp, const Host::Ptr& host)
|
|||||||
Service::Ptr hc = host->GetCheckService();
|
Service::Ptr hc = host->GetCheckService();
|
||||||
ObjectLock olock(hc);
|
ObjectLock olock(hc);
|
||||||
|
|
||||||
if (hc)
|
if (hc) {
|
||||||
|
/* only dump status data information for Classic UI */
|
||||||
|
fp << "\t" "check_service=" << hc->GetShortName() << "\n";
|
||||||
DumpServiceStatusAttrs(fp, hc, CompatTypeHost);
|
DumpServiceStatusAttrs(fp, hc, CompatTypeHost);
|
||||||
|
}
|
||||||
|
|
||||||
/* ugly but cgis parse only that */
|
/* ugly but cgis parse only that */
|
||||||
fp << "\t" "last_time_up=" << host->GetLastStateUp() << "\n"
|
fp << "\t" "last_time_up=" << host->GetLastStateUp() << "\n"
|
||||||
|
@ -1398,6 +1398,7 @@ 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)
|
||||||
|
2
components/db_ido_mysql/schema/upgrade/0.0.9.sql
Normal file
2
components/db_ido_mysql/schema/upgrade/0.0.9.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
ALTER TABLE icinga_hosts ADD COLUMN check_service_object_id bigint default NULL;
|
@ -1426,6 +1426,7 @@ 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)
|
||||||
|
2
components/db_ido_pgsql/schema/upgrade/0.0.9.sql
Normal file
2
components/db_ido_pgsql/schema/upgrade/0.0.9.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
ALTER TABLE icinga_hosts ADD COLUMN check_service_object_id bigint default NULL;
|
@ -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 + "check_service", Column(&HostsTable::CheckServiceAccessor, objectAccessor));
|
||||||
}
|
}
|
||||||
|
|
||||||
String HostsTable::GetName(void) const
|
String HostsTable::GetName(void) const
|
||||||
@ -1854,3 +1855,20 @@ Value HostsTable::ServicesWithInfoAccessor(const Value& row)
|
|||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value HostsTable::CheckServiceAccessor(const Value& row)
|
||||||
|
{
|
||||||
|
Host::Ptr host = static_cast<Host::Ptr>(row);
|
||||||
|
|
||||||
|
if (!host)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
Service::Ptr hc = host->GetCheckService();
|
||||||
|
|
||||||
|
Array::Ptr services = make_shared<Array>();
|
||||||
|
|
||||||
|
if (!hc)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
return hc->GetShortName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -141,9 +141,9 @@ 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 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 CheckServiceAccessor(const Value& row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
|
|
||||||
## <a id="schemas"></a> Schemas
|
## <a id="schemas"></a> Schemas
|
||||||
|
|
||||||
|
### <a id="schema-status-dat"></a> Status Data
|
||||||
|
|
||||||
|
Changes require newest Icinga Classic UI releases.
|
||||||
|
|
||||||
|
Object | Key
|
||||||
|
------------|--------------
|
||||||
|
hoststatus | check_service
|
||||||
|
|
||||||
|
|
||||||
### <a id="schema-db-ido"></a> DB IDO
|
### <a id="schema-db-ido"></a> DB IDO
|
||||||
|
|
||||||
There is a detailed documentation for the Icinga IDOUtils 1.x
|
There is a detailed documentation for the Icinga IDOUtils 1.x
|
||||||
@ -27,13 +36,14 @@ New tables: `endpoints`, `endpointstatus`
|
|||||||
|
|
||||||
New columns:
|
New columns:
|
||||||
|
|
||||||
Table | Column | Type | Default | Description
|
Table | Column | Type | Default | Description
|
||||||
--------------------|--------------------|----------|---------|-------------
|
--------------------|-------------------------|----------|---------|-------------
|
||||||
all status/history | endpoint_object_id | bigint | NULL | FK: objects table
|
all status/history | endpoint_object_id | bigint | NULL | FK: objects table
|
||||||
servicestatus | check_source | TEXT | NULL | node name where check was executed
|
servicestatus | check_source | TEXT | NULL | node name where check was executed
|
||||||
hoststatus | check_source | TEXT | NULL | node name where check was executed
|
hoststatus | check_source | TEXT | NULL | node name where check was executed
|
||||||
statehistory | check_source | TEXT | NULL | node name where check was executed
|
statehistory | check_source | TEXT | NULL | node name where check was executed
|
||||||
logentries | object_id | bigint | NULL | FK: objects table (service associated with column)
|
logentries | object_id | bigint | NULL | FK: objects table (service associated with column)
|
||||||
|
hosts | check_service_object_id | bigint | NULL | FK: objects table (service associated with column)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -175,5 +185,6 @@ New columns:
|
|||||||
Table | Column
|
Table | Column
|
||||||
----------|--------------
|
----------|--------------
|
||||||
services | check_source
|
services | check_source
|
||||||
|
hosts | check_service
|
||||||
downtimes | triggers
|
downtimes | triggers
|
||||||
downtimes | trigger_time
|
downtimes | trigger_time
|
||||||
|
@ -51,6 +51,7 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
|
|||||||
fields->Set("address6", CompatUtility::GetHostAddress6(host));
|
fields->Set("address6", CompatUtility::GetHostAddress6(host));
|
||||||
|
|
||||||
if (service) {
|
if (service) {
|
||||||
|
fields->Set("check_service_object_id", service);
|
||||||
fields->Set("check_command_object_id", service->GetCheckCommand());
|
fields->Set("check_command_object_id", service->GetCheckCommand());
|
||||||
fields->Set("check_command_args", Empty);
|
fields->Set("check_command_args", Empty);
|
||||||
fields->Set("eventhandler_command_object_id", service->GetEventCommand());
|
fields->Set("eventhandler_command_object_id", service->GetEventCommand());
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
GET hosts
|
GET hosts
|
||||||
Columns: name parents childs
|
Columns: name parents childs check_service
|
||||||
ResponseHeader: fixed16
|
ResponseHeader: fixed16
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user