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

Method DisableHostgroupHostNotifications

lib/icinga/externalcommandprocessor.cpp:2213–2226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2211}
2212
2213void ExternalCommandProcessor::DisableHostgroupHostNotifications(double, const std::vector<String>& arguments)
2214{
2215 HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
2216
2217 if (!hg)
2218 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host notifications for non-existent hostgroup '" + arguments[0] + "'"));
2219
2220 for (const Host::Ptr& host : hg->GetMembers()) {
2221 Log(LogNotice, "ExternalCommandProcessor")
2222 << "Disabling notifications for host '" << host->GetName() << "'";
2223
2224 host->ModifyAttribute("enable_notifications", false);
2225 }
2226}
2227
2228void ExternalCommandProcessor::DisableHostgroupSvcNotifications(double, const std::vector<String>& arguments)
2229{

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