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

Method EnableServicegroupHostNotifications

lib/icinga/externalcommandprocessor.cpp:2245–2260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2243}
2244
2245void ExternalCommandProcessor::EnableServicegroupHostNotifications(double, const std::vector<String>& arguments)
2246{
2247 ServiceGroup::Ptr sg = ServiceGroup::GetByName(arguments[0]);
2248
2249 if (!sg)
2250 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host notifications for non-existent servicegroup '" + arguments[0] + "'"));
2251
2252 for (const Service::Ptr& service : sg->GetMembers()) {
2253 Host::Ptr host = service->GetHost();
2254
2255 Log(LogNotice, "ExternalCommandProcessor")
2256 << "Enabling notifications for host '" << host->GetName() << "'";
2257
2258 host->ModifyAttribute("enable_notifications", true);
2259 }
2260}
2261
2262void ExternalCommandProcessor::EnableServicegroupSvcNotifications(double, const std::vector<String>& arguments)
2263{

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected