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

Method ChangeSvcCheckCommand

lib/icinga/externalcommandprocessor.cpp:2019–2035  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2017}
2018
2019void ExternalCommandProcessor::ChangeSvcCheckCommand(double, const std::vector<String>& arguments)
2020{
2021 Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
2022
2023 if (!service)
2024 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change check command for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
2025
2026 CheckCommand::Ptr command = CheckCommand::GetByName(arguments[2]);
2027
2028 if (!command)
2029 BOOST_THROW_EXCEPTION(std::invalid_argument("Check command '" + arguments[2] + "' does not exist."));
2030
2031 Log(LogNotice, "ExternalCommandProcessor")
2032 << "Changing check command for service '" << arguments[1] << "' to '" << arguments[2] << "'";
2033
2034 service->ModifyAttribute("check_command", command->GetName());
2035}
2036
2037void ExternalCommandProcessor::ChangeMaxHostCheckAttempts(double, const std::vector<String>& arguments)
2038{

Callers

nothing calls this directly

Calls 3

LogClass · 0.85
ModifyAttributeMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected