MCPcopy Create free account
hub / github.com/Icinga/icinga2 / EnableHostgroupSvcChecks

Method EnableHostgroupSvcChecks

lib/icinga/externalcommandprocessor.cpp:755–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const std::vector<String>& arguments)
756{
757 HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
758
759 if (!hg)
760 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable hostgroup service checks for non-existent hostgroup '" + arguments[0] + "'"));
761
762 for (const Host::Ptr& host : hg->GetMembers()) {
763 for (const Service::Ptr& service : host->GetServices()) {
764 Log(LogNotice, "ExternalCommandProcessor")
765 << "Enabling active checks for service '" << service->GetName() << "'";
766
767 service->ModifyAttribute("enable_active_checks", true);
768 }
769 }
770}
771
772void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const std::vector<String>& arguments)
773{

Callers

nothing calls this directly

Calls 5

LogClass · 0.85
ModifyAttributeMethod · 0.80
GetMembersMethod · 0.45
GetServicesMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected