public function renderAcknowledgeProblem(AcknowledgeProblemCommand $command)
 {
     $object = $command->getObject();
     if ($command->getObject()->getType() === $command::TYPE_HOST) {
         /** @var \Icinga\Module\Monitoring\Object\Host $object */
         $commandString = sprintf('%s;%s', $command->getExpireTime() !== null ? 'ACKNOWLEDGE_HOST_PROBLEM_EXPIRE' : 'ACKNOWLEDGE_HOST_PROBLEM', $object->getName());
     } else {
         /** @var \Icinga\Module\Monitoring\Object\Service $object */
         $commandString = sprintf('%s;%s;%s', $command->getExpireTime() !== null ? 'ACKNOWLEDGE_SVC_PROBLEM_EXPIRE' : 'ACKNOWLEDGE_SVC_PROBLEM', $object->getHost()->getName(), $object->getName());
     }
     $commandString = sprintf('%s;%u;%u;%u', $commandString, $command->getSticky() ? 2 : 0, $command->getNotify(), $command->getPersistent());
     if ($command->getExpireTime() !== null) {
         $commandString = sprintf('%s;%u', $commandString, $command->getExpireTime());
     }
     return sprintf('%s;%s;%s', $commandString, $command->getAuthor(), $command->getComment());
 }
Ejemplo n.º 2
0
 public function renderAcknowledgeProblem(AcknowledgeProblemCommand $command)
 {
     $endpoint = 'actions/acknowledge-problem';
     $data = array('author' => $command->getAuthor(), 'comment' => $command->getComment(), 'expiry' => $command->getExpireTime(), 'sticky' => $command->getSticky(), 'notify' => $command->getNotify());
     $this->applyFilter($data, $command->getObject());
     return IcingaApiCommand::create($endpoint, $data);
 }