| 632 | } |
| 633 | |
| 634 | void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const std::vector<String>& arguments) |
| 635 | { |
| 636 | bool sticky = (Convert::ToLong(arguments[2]) == 2 ? true : false); |
| 637 | bool notify = (Convert::ToLong(arguments[3]) > 0 ? true : false); |
| 638 | bool persistent = (Convert::ToLong(arguments[4]) > 0 ? true : false); |
| 639 | double timestamp = Convert::ToDouble(arguments[5]); |
| 640 | |
| 641 | Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]); |
| 642 | ObjectLock oLock (service); |
| 643 | |
| 644 | if (!service) |
| 645 | BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge service problem with expire time for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); |
| 646 | |
| 647 | if (service->GetState() == ServiceOK) |
| 648 | BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK.")); |
| 649 | |
| 650 | if (timestamp != 0 && timestamp <= Utility::GetTime()) |
| 651 | BOOST_THROW_EXCEPTION(std::invalid_argument("Acknowledgement expire time must be in the future for service '" + arguments[1] + "' on host '" + arguments[0] + "'")); |
| 652 | |
| 653 | if (service->IsAcknowledged()) { |
| 654 | BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is already acknowledged.")); |
| 655 | } |
| 656 | |
| 657 | Log(LogNotice, "ExternalCommandProcessor") |
| 658 | << "Setting timed acknowledgement for service '" << service->GetName() << "'" << (notify ? "" : ". Disabled notification"); |
| 659 | |
| 660 | Comment::AddComment(service, CommentAcknowledgement, arguments[6], arguments[7], persistent, timestamp, sticky); |
| 661 | service->AcknowledgeProblem(arguments[6], arguments[7], sticky ? AcknowledgementSticky : AcknowledgementNormal, notify, persistent, Utility::GetTime(), timestamp); |
| 662 | } |
| 663 | |
| 664 | void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const std::vector<String>& arguments) |
| 665 | { |
nothing calls this directly
no test coverage detected