Enable propagate host downtime commands for Icinga 2
This only works when using the latest Icinga 2 snapshot packages. Before releasing Web 2.4.0, we have to include a check to only offer these commands when using Icinga 2 2.6.0+ refs #10774
This commit is contained in:
parent
2b060d9bd4
commit
93474972bf
|
@ -34,24 +34,22 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
|
|||
)
|
||||
);
|
||||
|
||||
if (! $this->getBackend()->isIcinga2()) {
|
||||
$this->addElement(
|
||||
'select',
|
||||
'child_hosts',
|
||||
array(
|
||||
'description' => $this->translate(
|
||||
'Define what should be done with the child hosts of the hosts.'
|
||||
),
|
||||
'label' => $this->translate('Child Hosts'),
|
||||
'multiOptions' => array(
|
||||
0 => $this->translate('Do nothing with child hosts'),
|
||||
1 => $this->translate('Schedule triggered downtime for all child hosts'),
|
||||
2 => $this->translate('Schedule non-triggered downtime for all child hosts')
|
||||
),
|
||||
'value' => 0
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->addElement(
|
||||
'select',
|
||||
'child_hosts',
|
||||
array(
|
||||
'description' => $this->translate(
|
||||
'Define what should be done with the child hosts of the hosts.'
|
||||
),
|
||||
'label' => $this->translate('Child Hosts'),
|
||||
'multiOptions' => array(
|
||||
0 => $this->translate('Do nothing with child hosts'),
|
||||
1 => $this->translate('Schedule triggered downtime for all child hosts'),
|
||||
2 => $this->translate('Schedule non-triggered downtime for all child hosts')
|
||||
),
|
||||
'value' => 0
|
||||
)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use Icinga\Module\Monitoring\Command\Object\AddCommentCommand;
|
|||
use Icinga\Module\Monitoring\Command\Object\DeleteCommentCommand;
|
||||
use Icinga\Module\Monitoring\Command\Object\DeleteDowntimeCommand;
|
||||
use Icinga\Module\Monitoring\Command\Object\ProcessCheckResultCommand;
|
||||
use Icinga\Module\Monitoring\Command\Object\PropagateHostDowntimeCommand;
|
||||
use Icinga\Module\Monitoring\Command\Object\RemoveAcknowledgementCommand;
|
||||
use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand;
|
||||
use Icinga\Module\Monitoring\Command\Object\ScheduleServiceDowntimeCommand;
|
||||
|
@ -148,6 +149,12 @@ class IcingaApiCommandRenderer implements IcingaCommandRendererInterface
|
|||
'fixed' => $command->getFixed(),
|
||||
'trigger_name' => $command->getTriggerId()
|
||||
);
|
||||
if ($command->getObject()->getType() === $command::TYPE_HOST
|
||||
&& $command instanceof PropagateHostDowntimeCommand
|
||||
) {
|
||||
/** @var \Icinga\Module\Monitoring\Command\Object\PropagateHostDowntimeCommand $command */
|
||||
$data['child_options'] = $command->getTriggered() ? 1 : 2;
|
||||
}
|
||||
$this->applyFilter($data, $command->getObject());
|
||||
return IcingaApiCommand::create($endpoint, $data);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue