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

Method DisableHostgroupPassiveSvcChecks

lib/icinga/externalcommandprocessor.cpp:918–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

916}
917
918void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const std::vector<String>& arguments)
919{
920 HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
921
922 if (!hg)
923 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable hostgroup passive service checks for non-existent hostgroup '" + arguments[0] + "'"));
924
925 for (const Host::Ptr& host : hg->GetMembers()) {
926 for (const Service::Ptr& service : host->GetServices()) {
927 Log(LogNotice, "ExternalCommandProcessor")
928 << "Disabling passive checks for service '" << service->GetName() << "'";
929
930 service->ModifyAttribute("enable_passive_checks", false);
931 }
932 }
933}
934
935void ExternalCommandProcessor::ProcessFile(const WaitGroup::Ptr& producer, double, const std::vector<String>& arguments)
936{

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