mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
parent
4d8b6dddf1
commit
71ffd0ed74
@ -31,8 +31,8 @@ class CheckNowCommandForm extends ObjectsCommandForm
|
|||||||
{
|
{
|
||||||
$this->addElements(array(
|
$this->addElements(array(
|
||||||
array(
|
array(
|
||||||
'note',
|
'note', // Bogus
|
||||||
'icon',
|
'icon', // Bogus
|
||||||
array(
|
array(
|
||||||
'decorators' => array(array(
|
'decorators' => array(array(
|
||||||
'HtmlTag',
|
'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;
|
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)
|
* (non-PHPDoc)
|
||||||
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
|
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
|
||||||
@ -79,11 +87,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
|
|||||||
foreach ($this->objects as $object) {
|
foreach ($this->objects as $object) {
|
||||||
/** @var \Icinga\Module\Monitoring\Object\Service $object */
|
/** @var \Icinga\Module\Monitoring\Object\Service $object */
|
||||||
$check = new ScheduleServiceCheckCommand();
|
$check = new ScheduleServiceCheckCommand();
|
||||||
$check
|
$check->setObject($object);
|
||||||
->setObject($object)
|
$this->scheduleCheck($check, $request);
|
||||||
->setForced((bool) $this->getElement('force_check')->getValue())
|
|
||||||
->setCheckTime($this->getElement('check_time')->getValue());
|
|
||||||
$this->getTransport($request)->send($check);
|
|
||||||
}
|
}
|
||||||
Notification::success(mt('monitoring', 'Scheduling service check..'));
|
Notification::success(mt('monitoring', 'Scheduling service check..'));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user