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

Method EnableHostgroupHostNotifications

lib/icinga/externalcommandprocessor.cpp:2181–2194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2179}
2180
2181void ExternalCommandProcessor::EnableHostgroupHostNotifications(double, const std::vector<String>& arguments)
2182{
2183 HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
2184
2185 if (!hg)
2186 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host notifications for non-existent hostgroup '" + arguments[0] + "'"));
2187
2188 for (const Host::Ptr& host : hg->GetMembers()) {
2189 Log(LogNotice, "ExternalCommandProcessor")
2190 << "Enabling notifications for host '" << host->GetName() << "'";
2191
2192 host->ModifyAttribute("enable_notifications", true);
2193 }
2194}
2195
2196void ExternalCommandProcessor::EnableHostgroupSvcNotifications(double, const std::vector<String>& arguments)
2197{

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected