parent
4d8b6dddf1
commit
71ffd0ed74
|
@ -31,8 +31,8 @@ class CheckNowCommandForm extends ObjectsCommandForm
|
|||
{
|
||||
$this->addElements(array(
|
||||
array(
|
||||
'note',
|
||||
'icon',
|
||||
'note', // Bogus
|
||||
'icon', // Bogus
|
||||
array(
|
||||
'decorators' => array(array(
|
||||
'HtmlTag',
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Form\Command\Object;
|
||||
|
||||
use Icinga\Module\Monitoring\Command\Object\ScheduleHostCheckCommand;
|
||||
use Icinga\Web\Notification;
|
||||
use Icinga\Web\Request;
|
||||
|
||||
/**
|
||||
* Form for scheduling host checks
|
||||
*/
|
||||
class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm
|
||||
{
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Form::createElements() For the method documentation.
|
||||
*/
|
||||
public function createElements(array $formData = array())
|
||||
{
|
||||
parent::createElements($formData);
|
||||
$this->addElements(array(
|
||||
array(
|
||||
'checkbox',
|
||||
'all_services',
|
||||
array(
|
||||
'label' => mt('monitoring', 'All Services'),
|
||||
'value' => true,
|
||||
'description' => mt(
|
||||
'monitoring',
|
||||
'Schedule check for all services on the hosts and the hosts themself.'
|
||||
)
|
||||
)
|
||||
)
|
||||
));
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
|
||||
*/
|
||||
public function onSuccess(Request $request)
|
||||
{
|
||||
foreach ($this->objects as $object) {
|
||||
/** @var \Icinga\Module\Monitoring\Object\Host $object */
|
||||
$check = new ScheduleHostCheckCommand();
|
||||
$check
|
||||
->setObject($object)
|
||||
->setOfAllServices($this->getElement('all_services')->isChecked());
|
||||
$this->scheduleCheck($check, $request);
|
||||
}
|
||||
Notification::success(mt('monitoring', 'Scheduling host check..'));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -70,6 +70,14 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function scheduleCheck(ScheduleServiceCheckCommand $check, Request $request)
|
||||
{
|
||||
$check
|
||||
->setForced($this->getElement('force_check')->isChecked())
|
||||
->setCheckTime($this->getElement('check_time')->getValue()->getTimestamp());
|
||||
$this->getTransport($request)->send($check);
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
|
||||
|
@ -79,11 +87,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
|
|||
foreach ($this->objects as $object) {
|
||||
/** @var \Icinga\Module\Monitoring\Object\Service $object */
|
||||
$check = new ScheduleServiceCheckCommand();
|
||||
$check
|
||||
->setObject($object)
|
||||
->setForced((bool) $this->getElement('force_check')->getValue())
|
||||
->setCheckTime($this->getElement('check_time')->getValue());
|
||||
$this->getTransport($request)->send($check);
|
||||
$check->setObject($object);
|
||||
$this->scheduleCheck($check, $request);
|
||||
}
|
||||
Notification::success(mt('monitoring', 'Scheduling service check..'));
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue