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

Method ChangeHostCheckTimeperiod

lib/icinga/externalcommandprocessor.cpp:2067–2083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2065}
2066
2067void ExternalCommandProcessor::ChangeHostCheckTimeperiod(double, const std::vector<String>& arguments)
2068{
2069 Host::Ptr host = Host::GetByName(arguments[0]);
2070
2071 if (!host)
2072 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change check period for non-existent host '" + arguments[0] + "'"));
2073
2074 TimePeriod::Ptr tp = TimePeriod::GetByName(arguments[1]);
2075
2076 if (!tp)
2077 BOOST_THROW_EXCEPTION(std::invalid_argument("Time period '" + arguments[1] + "' does not exist."));
2078
2079 Log(LogNotice, "ExternalCommandProcessor")
2080 << "Changing check period for host '" << arguments[0] << "' to '" << arguments[1] << "'";
2081
2082 host->ModifyAttribute("check_period", tp->GetName());
2083}
2084
2085void ExternalCommandProcessor::ChangeSvcCheckTimeperiod(double, const std::vector<String>& arguments)
2086{

Callers

nothing calls this directly

Calls 3

LogClass · 0.85
ModifyAttributeMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected