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

Method EnableHostgroupPassiveSvcChecks

lib/icinga/externalcommandprocessor.cpp:901–916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899}
900
901void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const std::vector<String>& arguments)
902{
903 HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
904
905 if (!hg)
906 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable hostgroup passive service checks for non-existent hostgroup '" + arguments[0] + "'"));
907
908 for (const Host::Ptr& host : hg->GetMembers()) {
909 for (const Service::Ptr& service : host->GetServices()) {
910 Log(LogNotice, "ExternalCommandProcessor")
911 << "Enabling passive checks for service '" << service->GetName() << "'";
912
913 service->ModifyAttribute("enable_passive_checks", true);
914 }
915 }
916}
917
918void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const std::vector<String>& arguments)
919{

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