| 680 | } |
| 681 | |
| 682 | void ExternalCommandProcessor::AcknowledgeHostProblem(double, const std::vector<String>& arguments) |
| 683 | { |
| 684 | bool sticky = (Convert::ToLong(arguments[1]) == 2 ? true : false); |
| 685 | bool notify = (Convert::ToLong(arguments[2]) > 0 ? true : false); |
| 686 | bool persistent = (Convert::ToLong(arguments[3]) > 0 ? true : false); |
| 687 | |
| 688 | Host::Ptr host = Host::GetByName(arguments[0]); |
| 689 | ObjectLock oLock (host); |
| 690 | |
| 691 | if (!host) |
| 692 | BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge host problem for non-existent host '" + arguments[0] + "'")); |
| 693 | |
| 694 | Log(LogNotice, "ExternalCommandProcessor") |
| 695 | << "Setting acknowledgement for host '" << host->GetName() << "'" << (notify ? "" : ". Disabled notification"); |
| 696 | |
| 697 | if (host->GetState() == HostUp) |
| 698 | BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK.")); |
| 699 | |
| 700 | if (host->IsAcknowledged()) { |
| 701 | BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[1] + "' is already acknowledged.")); |
| 702 | } |
| 703 | |
| 704 | Comment::AddComment(host, CommentAcknowledgement, arguments[4], arguments[5], persistent, 0, sticky); |
| 705 | host->AcknowledgeProblem(arguments[4], arguments[5], sticky ? AcknowledgementSticky : AcknowledgementNormal, notify, persistent); |
| 706 | } |
| 707 | |
| 708 | void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const std::vector<String>& arguments) |
| 709 | { |
nothing calls this directly
no test coverage detected