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

Method DisableHostgroupSvcNotifications

lib/icinga/externalcommandprocessor.cpp:2228–2243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2226}
2227
2228void ExternalCommandProcessor::DisableHostgroupSvcNotifications(double, const std::vector<String>& arguments)
2229{
2230 HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
2231
2232 if (!hg)
2233 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service notifications for non-existent hostgroup '" + arguments[0] + "'"));
2234
2235 for (const Host::Ptr& host : hg->GetMembers()) {
2236 for (const Service::Ptr& service : host->GetServices()) {
2237 Log(LogNotice, "ExternalCommandProcessor")
2238 << "Disabling notifications for service '" << service->GetName() << "'";
2239
2240 service->ModifyAttribute("enable_notifications", false);
2241 }
2242 }
2243}
2244
2245void ExternalCommandProcessor::EnableServicegroupHostNotifications(double, const std::vector<String>& arguments)
2246{

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