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

Method ChangeHostCheckCommand

lib/icinga/externalcommandprocessor.cpp:2001–2017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1999}
2000
2001void ExternalCommandProcessor::ChangeHostCheckCommand(double, const std::vector<String>& arguments)
2002{
2003 Host::Ptr host = Host::GetByName(arguments[0]);
2004
2005 if (!host)
2006 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change check command for non-existent host '" + arguments[0] + "'"));
2007
2008 CheckCommand::Ptr command = CheckCommand::GetByName(arguments[1]);
2009
2010 if (!command)
2011 BOOST_THROW_EXCEPTION(std::invalid_argument("Check command '" + arguments[1] + "' does not exist."));
2012
2013 Log(LogNotice, "ExternalCommandProcessor")
2014 << "Changing check command for host '" << arguments[0] << "' to '" << arguments[1] << "'";
2015
2016 host->ModifyAttribute("check_command", command->GetName());
2017}
2018
2019void ExternalCommandProcessor::ChangeSvcCheckCommand(double, const std::vector<String>& arguments)
2020{

Callers

nothing calls this directly

Calls 3

LogClass · 0.85
ModifyAttributeMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected