/** * (non-PHPDoc) * @see \Icinga\Web\Form::onSuccess() For the method documentation. */ public function onSuccess() { foreach ($this->objects as $object) { /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ $command = new ProcessCheckResultCommand(); $command->setObject($object); $command->setStatus($this->getValue('status')); $command->setOutput($this->getValue('output')); if ($perfdata = $this->getValue('perfdata')) { $command->setPerformanceData($perfdata); } $this->getTransport($this->request)->send($command); } Notification::success($this->translatePlural('Processing check result..', 'Processing check results..', count($this->objects))); return true; }
public function renderProcessCheckResult(ProcessCheckResultCommand $command) { $object = $command->getObject(); if ($command->getObject()->getType() === $command::TYPE_HOST) { /** @var \Icinga\Module\Monitoring\Object\Host $object */ $commandString = sprintf('PROCESS_HOST_CHECK_RESULT;%s', $object->getName()); } else { /** @var \Icinga\Module\Monitoring\Object\Service $object */ $commandString = sprintf('PROCESS_SERVICE_CHECK_RESULT;%s;%s', $object->getHost()->getName(), $object->getName()); } $output = $command->getOutput(); if ($command->getPerformanceData() !== null) { $output .= '|' . $command->getPerformanceData(); } return sprintf('%s;%u;%s', $commandString, $command->getStatus(), $output); }
public function renderProcessCheckResult(ProcessCheckResultCommand $command) { $endpoint = 'actions/process-check-result'; $data = array('exit_status' => $command->getStatus(), 'plugin_output' => $command->getOutput(), 'performance_data' => $command->getPerformanceData()); $this->applyFilter($data, $command->getObject()); return IcingaApiCommand::create($endpoint, $data); }