public function renderScheduleCheck(ScheduleServiceCheckCommand $command) { $object = $command->getObject(); if ($command->getObject()->getType() === $command::TYPE_HOST) { /** @var \Icinga\Module\Monitoring\Object\Host $object */ /** @var \Icinga\Module\Monitoring\Command\Object\ScheduleHostCheckCommand $command */ if ($command->getOfAllServices() === true) { if ($command->getForced() === true) { $commandName = 'SCHEDULE_FORCED_HOST_SVC_CHECKS'; } else { $commandName = 'SCHEDULE_HOST_SVC_CHECKS'; } } else { if ($command->getForced() === true) { $commandName = 'SCHEDULE_FORCED_HOST_CHECK'; } else { $commandName = 'SCHEDULE_HOST_CHECK'; } } $commandString = sprintf('%s;%s', $commandName, $object->getName()); } else { /** @var \Icinga\Module\Monitoring\Object\Service $object */ $commandString = sprintf('%s;%s;%s', $command->getForced() === true ? 'SCHEDULE_FORCED_SVC_CHECK' : 'SCHEDULE_SVC_CHECK', $object->getHost()->getName(), $object->getName()); } return sprintf('%s;%u', $commandString, $command->getCheckTime()); }
public function renderScheduleCheck(ScheduleServiceCheckCommand $command) { $endpoint = 'actions/reschedule-check'; $data = array('next_check' => $command->getCheckTime(), 'force_check' => $command->getForced()); $this->applyFilter($data, $command->getObject()); return IcingaApiCommand::create($endpoint, $data); }