public function renderSendCustomNotification(SendCustomNotificationCommand $command)
 {
     $object = $command->getObject();
     if ($command->getObject()->getType() === $command::TYPE_HOST) {
         /** @var \Icinga\Module\Monitoring\Object\Host $object */
         $commandString = sprintf('SEND_CUSTOM_HOST_NOTIFICATION;%s', $object->getName());
     } else {
         /** @var \Icinga\Module\Monitoring\Object\Service $object */
         $commandString = sprintf('SEND_CUSTOM_SVC_NOTIFICATION;%s;%s', $object->getHost()->getName(), $object->getName());
     }
     $options = 0;
     // 0 for no options
     if ($command->getBroadcast() === true) {
         $options |= 1;
     }
     if ($command->getForced() === true) {
         $options |= 2;
     }
     return sprintf('%s;%u;%s;%s', $commandString, $options, $command->getAuthor(), $command->getComment());
 }
Ejemplo n.º 2
0
 public function renderSendCustomNotification(SendCustomNotificationCommand $command)
 {
     $endpoint = 'actions/send-custom-notification';
     $data = array('author' => $command->getAuthor(), 'comment' => $command->getComment(), 'force' => $command->getForced());
     $this->applyFilter($data, $command->getObject());
     return IcingaApiCommand::create($endpoint, $data);
 }