mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
Fix cluster check w/ immediate parent and child zone endpoints
fixes #9262
This commit is contained in:
parent
f7ac2d97d0
commit
b6b6115a5f
@ -797,16 +797,27 @@ std::pair<Dictionary::Ptr, Dictionary::Ptr> ApiListener::GetStatus(void)
|
|||||||
Array::Ptr not_connected_endpoints = new Array();
|
Array::Ptr not_connected_endpoints = new Array();
|
||||||
Array::Ptr connected_endpoints = new Array();
|
Array::Ptr connected_endpoints = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
|
Zone::Ptr my_zone = Zone::GetLocalZone();
|
||||||
if (endpoint->GetName() == GetIdentity())
|
|
||||||
|
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
|
||||||
|
/* only check endpoints in a) the same zone b) our parent zone c) immediate child zones */
|
||||||
|
if (my_zone != zone && my_zone != zone->GetParent() && zone != my_zone->GetParent()) {
|
||||||
|
Log(LogDebug, "ApiListener")
|
||||||
|
<< "Not checking connection to Zone '" << zone->GetName() << "' because it's not in the same zone, a parent or a child zone.";
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
count_endpoints++;
|
BOOST_FOREACH(const Endpoint::Ptr& endpoint, zone->GetEndpoints()) {
|
||||||
|
if (endpoint->GetName() == GetIdentity())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!endpoint->IsConnected())
|
count_endpoints++;
|
||||||
not_connected_endpoints->Add(endpoint->GetName());
|
|
||||||
else
|
if (!endpoint->IsConnected())
|
||||||
connected_endpoints->Add(endpoint->GetName());
|
not_connected_endpoints->Add(endpoint->GetName());
|
||||||
|
else
|
||||||
|
connected_endpoints->Add(endpoint->GetName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status->Set("num_endpoints", count_endpoints);
|
status->Set("num_endpoints", count_endpoints);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user