2013-06-27 10:14:41 +02:00
|
|
|
<?php
|
2013-07-18 13:46:12 +02:00
|
|
|
// @codingStandardsIgnoreStart
|
|
|
|
|
2013-07-16 15:39:47 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
/**
|
|
|
|
* This file is part of Icinga 2 Web.
|
|
|
|
*
|
|
|
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
|
|
|
* Copyright (C) 2013 Icinga Development Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
|
|
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
|
|
|
* @author Icinga Development Team <info@icinga.org>
|
|
|
|
*/
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
use Icinga\Application\Benchmark;
|
2013-07-04 13:52:34 +02:00
|
|
|
use Icinga\Backend;
|
|
|
|
use Icinga\Application\Config;
|
2013-07-08 15:42:39 +02:00
|
|
|
use Icinga\Authentication\Manager;
|
2013-07-18 13:46:12 +02:00
|
|
|
use Icinga\Web\Form;
|
2013-06-27 10:14:41 +02:00
|
|
|
use Icinga\Web\ModuleActionController;
|
2013-07-08 15:42:39 +02:00
|
|
|
use Icinga\Protocol\Commandpipe\Comment;
|
2013-07-04 13:52:34 +02:00
|
|
|
use Icinga\Protocol\Commandpipe\CommandPipe;
|
2013-07-08 15:42:39 +02:00
|
|
|
use Icinga\Protocol\Commandpipe\Acknowledgement;
|
2013-07-04 13:52:34 +02:00
|
|
|
use Icinga\Exception\ConfigurationError;
|
|
|
|
use Icinga\Exception\MissingParameterException;
|
2013-07-23 17:09:06 +02:00
|
|
|
use Monitoring\Form\Command\AcknowledgeForm;
|
|
|
|
use Monitoring\Form\Command\CommentForm;
|
|
|
|
use Monitoring\Form\Command\ConfirmationForm;
|
|
|
|
use Monitoring\Form\Command\ConfirmationWithIdentifierForm;
|
|
|
|
use Monitoring\Form\Command\CustomNotificationForm;
|
|
|
|
use Monitoring\Form\Command\DelayNotificationForm;
|
|
|
|
use Monitoring\Form\Command\RescheduleNextCheckForm;
|
|
|
|
use Monitoring\Form\Command\ScheduleDowntimeForm;
|
|
|
|
use Monitoring\Form\Command\SubmitPassiveCheckResultForm;
|
2013-07-16 15:39:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Monitoring_CommandController
|
|
|
|
*
|
|
|
|
* Interface to send commands and display forms
|
|
|
|
*/
|
2013-06-27 10:14:41 +02:00
|
|
|
class Monitoring_CommandController extends ModuleActionController
|
|
|
|
{
|
2013-07-16 15:39:47 +02:00
|
|
|
const DEFAULT_VIEW_SCRIPT = 'renderform';
|
|
|
|
|
2013-06-27 10:14:41 +02:00
|
|
|
/**
|
2013-07-18 13:46:12 +02:00
|
|
|
* Command target
|
|
|
|
* @var CommandPipe
|
|
|
|
*/
|
|
|
|
private $target;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Current form working on
|
|
|
|
* @var Form
|
2013-06-27 10:14:41 +02:00
|
|
|
*/
|
2013-07-18 13:46:12 +02:00
|
|
|
private $form;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setter for form
|
|
|
|
* @param Form $form
|
|
|
|
*/
|
|
|
|
public function setForm($form)
|
|
|
|
{
|
|
|
|
$this->form = $form;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Getter for form
|
|
|
|
* @return Form
|
|
|
|
*/
|
|
|
|
public function getForm()
|
|
|
|
{
|
|
|
|
return $this->form;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test if we have a valid form object
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function issetForm()
|
|
|
|
{
|
|
|
|
return $this->getForm() !== null && ($this->getForm() instanceof Form);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Post dispatch method
|
|
|
|
*
|
|
|
|
* When we have a form put it into the view
|
|
|
|
*/
|
|
|
|
public function postDispatch()
|
|
|
|
{
|
|
|
|
if ($this->issetForm()) {
|
|
|
|
if ($this->getRequest()->isPost() && $this->getForm()->isValid(null) === true) {
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
}
|
|
|
|
$this->view->form = $this->getForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
parent::postDispatch();
|
|
|
|
}
|
|
|
|
|
2013-06-27 10:14:41 +02:00
|
|
|
|
2013-07-16 15:39:47 +02:00
|
|
|
/**
|
|
|
|
* Controller configuration
|
|
|
|
* @throws Icinga\Exception\ConfigurationError
|
|
|
|
*/
|
2013-06-27 10:14:41 +02:00
|
|
|
public function init()
|
|
|
|
{
|
2013-07-17 14:08:07 +02:00
|
|
|
if ($this->_request->isPost()) {
|
|
|
|
|
|
|
|
$instance = $this->_request->getPost("instance");
|
|
|
|
|
|
|
|
$targetConfig = Config::module('monitoring', 'instances');
|
|
|
|
|
|
|
|
if ($instance) {
|
|
|
|
if ($targetConfig->get($instance)) {
|
|
|
|
$this->target = new CommandPipe($targetConfig->get($instance));
|
|
|
|
} else {
|
|
|
|
throw new ConfigurationError('Instance is not configured: '. $instance);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$targetInfo = $targetConfig->current(); // Take the very first section
|
|
|
|
|
|
|
|
if ($targetInfo === false) {
|
|
|
|
throw new ConfigurationError("Not any instances are configured yet");
|
|
|
|
} else {
|
|
|
|
$this->target = new CommandPipe($targetInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-17 14:47:51 +02:00
|
|
|
if ($this->getRequest()->getActionName() !== 'list') {
|
|
|
|
// Reduce template writing mess
|
|
|
|
$this->_helper->viewRenderer->setRender(self::DEFAULT_VIEW_SCRIPT);
|
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
|
2013-07-16 15:39:47 +02:00
|
|
|
/**
|
|
|
|
* Retrieve all existing targets for host- and service combination
|
|
|
|
* @param string $hostname
|
|
|
|
* @param string $servicename
|
|
|
|
* @return array
|
|
|
|
* @throws Icinga\Exception\MissingParameterException
|
|
|
|
*/
|
2013-07-05 16:07:50 +02:00
|
|
|
private function selectCommandTargets($hostname, $servicename = null)
|
2013-06-27 10:14:41 +02:00
|
|
|
{
|
|
|
|
$target = "hostlist";
|
|
|
|
$filter = array();
|
|
|
|
if (!$hostname && !$servicename) {
|
2013-07-04 13:52:34 +02:00
|
|
|
throw new MissingParameterException("Missing host and service definition");
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
if ($hostname) {
|
2013-07-05 16:07:50 +02:00
|
|
|
$filter["host_name"] = $hostname;
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
if ($servicename) {
|
2013-07-05 16:07:50 +02:00
|
|
|
$filter["service_description"] = $servicename;
|
2013-06-27 10:14:41 +02:00
|
|
|
$target = "servicelist";
|
|
|
|
}
|
2013-07-04 13:52:34 +02:00
|
|
|
return Backend::getInstance()->select()->from($target)->applyFilters($filter)->fetchAll();
|
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
|
2013-07-16 15:39:47 +02:00
|
|
|
/**
|
2013-07-17 14:47:51 +02:00
|
|
|
* Displays a list of all commands
|
2013-07-16 15:39:47 +02:00
|
|
|
*/
|
2013-07-17 14:47:51 +02:00
|
|
|
public function listAction()
|
2013-07-04 13:52:34 +02:00
|
|
|
{
|
2013-07-17 14:47:51 +02:00
|
|
|
$reflection = new ReflectionObject($this);
|
|
|
|
$commands = array();
|
|
|
|
$methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
|
|
|
|
foreach ($methods as $method) {
|
|
|
|
$name = $method->getName();
|
|
|
|
if ($name !== 'listAction' && preg_match('/Action$/', $name)) {
|
|
|
|
$commands[] = preg_replace('/Action$/', '', $name);
|
|
|
|
}
|
2013-07-04 13:52:34 +02:00
|
|
|
}
|
2013-07-17 14:47:51 +02:00
|
|
|
$this->view->commands = $commands;
|
2013-07-04 13:52:34 +02:00
|
|
|
}
|
|
|
|
|
2013-07-16 15:39:47 +02:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Commands for hosts / services
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command disableactivechecks
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function disableactivechecksAction()
|
2013-07-04 13:52:34 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Disable active checks'));
|
|
|
|
$form->addNote(t('Disable active checks for this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-04 13:52:34 +02:00
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command enableactivechecks
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function enableactivechecksAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Enable active checks'));
|
|
|
|
$form->addNote(t('Enable active checks for this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command reschedulenextcheck
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function reschedulenextcheckAction()
|
2013-06-27 10:14:41 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new RescheduleNextCheckForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
2013-06-27 10:14:41 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
2013-07-16 15:39:47 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command submitpassivecheckresult
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function submitpassivecheckresultAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$type = SubmitPassiveCheckResultForm::TYPE_SERVICE;
|
2013-06-27 10:14:41 +02:00
|
|
|
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new SubmitPassiveCheckResultForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setType($type);
|
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command stopobsessing
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function stopobsessingAction()
|
2013-06-27 10:14:41 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Stop obsessing'));
|
|
|
|
$form->addNote(t('Stop obsessing over this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 10:21:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command startobsessing
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function startobsessingAction()
|
2013-07-08 10:21:15 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Start obsessing'));
|
|
|
|
$form->addNote(t('Start obsessing over this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command stopacceptingpassivechecks
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function stopacceptingpassivechecksAction()
|
2013-07-08 10:23:19 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Stop accepting passive checks'));
|
|
|
|
$form->addNote(t('Passive checks for this object will be omitted.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 10:23:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command startacceptingpassivechecks
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function startacceptingpassivechecksAction()
|
2013-07-08 10:23:19 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Start accepting passive checks'));
|
|
|
|
$form->addNote(t('Passive checks for this object will be accepted.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 10:23:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command disablenotifications
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function disablenotificationsAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Disable notifications'));
|
|
|
|
$form->addNote(t('Notifications for this object will be disabled.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 11:11:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command enablenotifications
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function enablenotificationsAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Enable notifications'));
|
|
|
|
$form->addNote(t('Notifications for this object will be enabled.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 11:11:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command sendcustomnotification
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function sendcustomnotificationAction()
|
2013-06-27 10:14:41 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new CustomNotificationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 11:16:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command scheduledowntime
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function scheduledowntimeAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ScheduleDowntimeForm();
|
2013-07-17 14:08:07 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setWithChildren(false);
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-17 14:08:07 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
|
|
|
}
|
2013-07-16 15:39:47 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command scheduledowntimeswithchildren
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function scheduledowntimeswithchildrenAction()
|
2013-07-08 11:16:23 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ScheduleDowntimeForm();
|
2013-07-17 14:08:07 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setWithChildren(true);
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-17 14:08:07 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
|
|
|
}
|
2013-07-16 15:39:47 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command removedowntimeswithchildren
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function removedowntimeswithchildrenAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Remove downtime(s)'));
|
|
|
|
$form->addNote(t('Remove downtime(s) from this host and its services.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command disablenotificationswithchildren
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function disablenotificationswithchildrenAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Disable notifications'));
|
|
|
|
$form->addNote(t('Notifications for this host and its services will be disabled.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 11:38:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command enablenotificationswithchildren
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function enablenotificationswithchildrenAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Enable notifications'));
|
|
|
|
$form->addNote(t('Notifications for this host and its services will be enabled.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 11:38:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command reschedulenextcheckwithchildren
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function reschedulenextcheckwithchildrenAction()
|
2013-07-08 11:38:43 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new RescheduleNextCheckForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
$form->setWithChildren(true);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 11:38:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command disableactivecheckswithchildren
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function disableactivecheckswithchildrenAction()
|
2013-07-08 11:38:43 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Disable active checks'));
|
|
|
|
$form->addNote(t('Disable active checks for this host and its services.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 15:42:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command enableactivecheckswithchildren
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function enableactivecheckswithchildrenAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Enable active checks'));
|
|
|
|
$form->addNote(t('Enable active checks for this host and its services.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 15:42:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command disableeventhandler
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function disableeventhandlerAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Disable event handler'));
|
|
|
|
$form->addNote(t('Disable event handler for this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-08 16:35:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command enableeventhandler
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function enableeventhandlerAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Enable event handler'));
|
|
|
|
$form->addNote(t('Enable event handler for this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-09 12:40:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command disableflapdetection
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function disableflapdetectionAction()
|
2013-07-09 12:40:31 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Disable flapping detection'));
|
|
|
|
$form->addNote(t('Disable flapping detection for this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-09 13:50:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command enableflapdetection
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function enableflapdetectionAction()
|
2013-07-09 13:50:07 +02:00
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Enable flapping detection'));
|
|
|
|
$form->addNote(t('Enable flapping detection for this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command addcomment
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-09 16:27:59 +02:00
|
|
|
public function addcommentAction()
|
2013-06-27 10:14:41 +02:00
|
|
|
{
|
2013-07-16 15:39:47 +02:00
|
|
|
$form = new CommentForm();
|
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-09 16:27:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command resetattributes
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function resetattributesAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Reset attributes'));
|
|
|
|
$form->addNote(t('Reset modified attributes to its default.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-07-09 16:27:59 +02:00
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command acknowledgeproblem
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function acknowledgeproblemAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new AcknowledgeForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command removeacknowledgement
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function removeacknowledgementAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationForm();
|
2013-07-16 15:39:47 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
$form->setSubmitLabel(t('Remove problem acknowledgement'));
|
|
|
|
$form->addNote(t('Remove problem acknowledgement for this object.'));
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-16 15:39:47 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command delaynotification
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function delaynotificationAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new DelayNotificationForm();
|
2013-07-17 14:08:07 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-16 15:39:47 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-17 14:08:07 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
|
|
|
}
|
2013-07-16 15:39:47 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 14:08:07 +02:00
|
|
|
/**
|
|
|
|
* Handle command removedowntime
|
|
|
|
* @throws Icinga\Exception\ProgrammingError
|
|
|
|
*/
|
2013-07-16 15:39:47 +02:00
|
|
|
public function removedowntimeAction()
|
|
|
|
{
|
2013-07-23 17:09:06 +02:00
|
|
|
$form = new ConfirmationWithIdentifierForm();
|
2013-07-17 14:08:07 +02:00
|
|
|
$form->setRequest($this->getRequest());
|
|
|
|
|
|
|
|
$form->setSubmitLabel(t('Delete downtime'));
|
|
|
|
$form->setFieldName('downtimeid');
|
|
|
|
$form->setFieldLabel(t('Downtime id'));
|
|
|
|
$form->addNote(t('Delete a single downtime with the id shown above'));
|
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
$this->setForm($form);
|
2013-07-17 14:08:07 +02:00
|
|
|
|
2013-07-18 13:46:12 +02:00
|
|
|
if ($this->getRequest()->isPost() && $form->isValid(null)) {
|
2013-07-17 14:08:07 +02:00
|
|
|
throw new \Icinga\Exception\ProgrammingError('Command sender not implemented: '. __FUNCTION__);
|
|
|
|
}
|
2013-07-16 15:39:47 +02:00
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
2013-07-18 13:46:12 +02:00
|
|
|
|
|
|
|
// @codingStandardsIgnoreStop
|