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

Method ChangeSvcCheckTimeperiod

lib/icinga/externalcommandprocessor.cpp:2085–2101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2083}
2084
2085void ExternalCommandProcessor::ChangeSvcCheckTimeperiod(double, const std::vector<String>& arguments)
2086{
2087 Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
2088
2089 if (!service)
2090 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change check period for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
2091
2092 TimePeriod::Ptr tp = TimePeriod::GetByName(arguments[2]);
2093
2094 if (!tp)
2095 BOOST_THROW_EXCEPTION(std::invalid_argument("Time period '" + arguments[2] + "' does not exist."));
2096
2097 Log(LogNotice, "ExternalCommandProcessor")
2098 << "Changing check period for service '" << arguments[1] << "' to '" << arguments[2] << "'";
2099
2100 service->ModifyAttribute("check_period", tp->GetName());
2101}
2102
2103void ExternalCommandProcessor::ChangeCustomHostVar(double, const std::vector<String>& arguments)
2104{

Callers

nothing calls this directly

Calls 3

LogClass · 0.85
ModifyAttributeMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected