mirror of https://github.com/Icinga/icinga2.git
Fixed reachability calculation for host checks.
This commit is contained in:
parent
a960237139
commit
39b0806778
|
@ -159,9 +159,20 @@ String Service::GetShortName(void) const
|
|||
|
||||
bool Service::IsReachable(const Service::Ptr& self)
|
||||
{
|
||||
String service_name;
|
||||
|
||||
{
|
||||
ObjectLock olock(self);
|
||||
service_name = self->GetName();
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const Service::Ptr& service, Service::GetParentServices(self)) {
|
||||
ObjectLock olock(service);
|
||||
|
||||
/* ignore ourselves */
|
||||
if (service->GetName() == service_name)
|
||||
continue;
|
||||
|
||||
/* ignore pending services */
|
||||
if (!service->GetLastCheckResult())
|
||||
continue;
|
||||
|
@ -182,6 +193,10 @@ bool Service::IsReachable(const Service::Ptr& self)
|
|||
Service::Ptr hc = Host::GetHostCheckService(host);
|
||||
ObjectLock olock(hc);
|
||||
|
||||
/* ignore ourselves */
|
||||
if (hc->GetName() == service_name)
|
||||
continue;
|
||||
|
||||
/* ignore hosts that are up */
|
||||
if (hc && hc->GetState() == StateOK)
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue