| 706 | } |
| 707 | |
| 708 | void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const std::vector<String>& arguments) |
| 709 | { |
| 710 | bool sticky = (Convert::ToLong(arguments[1]) == 2 ? true : false); |
| 711 | bool notify = (Convert::ToLong(arguments[2]) > 0 ? true : false); |
| 712 | bool persistent = (Convert::ToLong(arguments[3]) > 0 ? true : false); |
| 713 | double timestamp = Convert::ToDouble(arguments[4]); |
| 714 | |
| 715 | Host::Ptr host = Host::GetByName(arguments[0]); |
| 716 | ObjectLock oLock (host); |
| 717 | |
| 718 | if (!host) |
| 719 | BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge host problem with expire time for non-existent host '" + arguments[0] + "'")); |
| 720 | |
| 721 | Log(LogNotice, "ExternalCommandProcessor") |
| 722 | << "Setting timed acknowledgement for host '" << host->GetName() << "'" << (notify ? "" : ". Disabled notification"); |
| 723 | |
| 724 | if (host->GetState() == HostUp) |
| 725 | BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK.")); |
| 726 | |
| 727 | if (timestamp != 0 && timestamp <= Utility::GetTime()) |
| 728 | BOOST_THROW_EXCEPTION(std::invalid_argument("Acknowledgement expire time must be in the future for host '" + arguments[0] + "'")); |
| 729 | |
| 730 | if (host->IsAcknowledged()) { |
| 731 | BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[1] + "' is already acknowledged.")); |
| 732 | } |
| 733 | |
| 734 | Comment::AddComment(host, CommentAcknowledgement, arguments[5], arguments[6], persistent, timestamp, sticky); |
| 735 | host->AcknowledgeProblem(arguments[5], arguments[6], sticky ? AcknowledgementSticky : AcknowledgementNormal, notify, persistent, Utility::GetTime(), timestamp); |
| 736 | } |
| 737 | |
| 738 | void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const std::vector<String>& arguments) |
| 739 | { |
nothing calls this directly
no test coverage detected