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

Method EnableHostgroupSvcNotifications

lib/icinga/externalcommandprocessor.cpp:2196–2211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2194}
2195
2196void ExternalCommandProcessor::EnableHostgroupSvcNotifications(double, const std::vector<String>& arguments)
2197{
2198 HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
2199
2200 if (!hg)
2201 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service notifications for non-existent hostgroup '" + arguments[0] + "'"));
2202
2203 for (const Host::Ptr& host : hg->GetMembers()) {
2204 for (const Service::Ptr& service : host->GetServices()) {
2205 Log(LogNotice, "ExternalCommandProcessor")
2206 << "Enabling notifications for service '" << service->GetName() << "'";
2207
2208 service->ModifyAttribute("enable_notifications", true);
2209 }
2210 }
2211}
2212
2213void ExternalCommandProcessor::DisableHostgroupHostNotifications(double, const std::vector<String>& arguments)
2214{

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