mirror of https://github.com/Icinga/icinga2.git
parent
c522b42c45
commit
32e1c02b9a
|
@ -111,13 +111,16 @@ bool Dependency::IsAvailable(DependencyType dt) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool is_service = parent->GetType() == DynamicType::GetByName("Service");
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(parent);
|
||||
|
||||
int state;
|
||||
|
||||
if (is_service)
|
||||
state = ServiceStateToFilter(static_pointer_cast<Service>(parent)->GetState());
|
||||
if (service)
|
||||
state = ServiceStateToFilter(service->GetState());
|
||||
else
|
||||
state = HostStateToFilter(static_pointer_cast<Host>(parent)->GetState());
|
||||
state = HostStateToFilter(host->GetState());
|
||||
|
||||
/* check state */
|
||||
if (state & GetStateFilter()) {
|
||||
|
|
|
@ -40,18 +40,12 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
|
||||
Value raw_command = commandObj->GetCommandLine();
|
||||
|
||||
bool is_service = checkable->GetType() == DynamicType::GetByName("Service");
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
||||
if (is_service) {
|
||||
service = static_pointer_cast<Service>(checkable);
|
||||
host = service->GetHost();
|
||||
} else
|
||||
host = static_pointer_cast<Host>(checkable);
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
std::vector<MacroResolver::Ptr> resolvers;
|
||||
if (is_service)
|
||||
if (service)
|
||||
resolvers.push_back(service);
|
||||
resolvers.push_back(host);
|
||||
resolvers.push_back(commandObj);
|
||||
|
|
|
@ -37,18 +37,12 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable)
|
|||
EventCommand::Ptr commandObj = checkable->GetEventCommand();
|
||||
Value raw_command = commandObj->GetCommandLine();
|
||||
|
||||
bool is_service = checkable->GetType() == DynamicType::GetByName("Service");
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
||||
if (is_service) {
|
||||
service = static_pointer_cast<Service>(checkable);
|
||||
host = service->GetHost();
|
||||
} else
|
||||
host = static_pointer_cast<Host>(checkable);
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
std::vector<MacroResolver::Ptr> resolvers;
|
||||
if (is_service)
|
||||
if (service)
|
||||
resolvers.push_back(service);
|
||||
resolvers.push_back(host);
|
||||
resolvers.push_back(commandObj);
|
||||
|
|
Loading…
Reference in New Issue