2014-09-04 15:43:37 +02:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2014-09-04 15:43:37 +02:00
|
|
|
|
2014-11-14 11:17:22 +01:00
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm;
|
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm;
|
2014-12-12 12:44:31 +01:00
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm;
|
2014-11-14 11:17:22 +01:00
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm;
|
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceDowntimeCommandForm;
|
2014-09-04 15:43:37 +02:00
|
|
|
use Icinga\Module\Monitoring\Object\Service;
|
2014-09-16 18:46:27 +02:00
|
|
|
use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController;
|
2014-09-04 15:43:37 +02:00
|
|
|
|
2014-09-16 18:46:27 +02:00
|
|
|
class Monitoring_ServiceController extends MonitoredObjectController
|
2014-09-04 15:43:37 +02:00
|
|
|
{
|
|
|
|
/**
|
2014-09-16 18:46:27 +02:00
|
|
|
* (non-PHPDoc)
|
|
|
|
* @see MonitoredObjectController::$commandRedirectUrl For the property documentation.
|
2014-09-04 15:43:37 +02:00
|
|
|
*/
|
2014-09-16 18:46:27 +02:00
|
|
|
protected $commandRedirectUrl = 'monitoring/service/show';
|
2014-09-04 15:43:37 +02:00
|
|
|
|
2014-09-16 18:46:27 +02:00
|
|
|
/**
|
|
|
|
* Fetch the requested service from the monitoring backend
|
|
|
|
*
|
|
|
|
* @throws Zend_Controller_Action_Exception If the service was not found
|
|
|
|
*/
|
|
|
|
public function init()
|
2014-09-04 15:43:37 +02:00
|
|
|
{
|
2014-09-12 16:50:42 +02:00
|
|
|
$service = new Service($this->backend, $this->params->get('host'), $this->params->get('service'));
|
2015-01-27 14:57:54 +01:00
|
|
|
|
|
|
|
$this->applyRestriction('monitoring/services/filter', $service);
|
|
|
|
|
2014-09-12 16:50:42 +02:00
|
|
|
if ($service->fetch() === false) {
|
|
|
|
throw new Zend_Controller_Action_Exception($this->translate('Service not found'));
|
|
|
|
}
|
2014-09-16 18:46:27 +02:00
|
|
|
$this->object = $service;
|
2014-09-24 07:16:33 +02:00
|
|
|
$this->createTabs();
|
|
|
|
$this->getTabs()->activate('service');
|
2014-09-04 15:43:37 +02:00
|
|
|
}
|
|
|
|
|
2014-09-12 16:50:42 +02:00
|
|
|
/**
|
2014-09-16 18:46:27 +02:00
|
|
|
* Acknowledge a service problem
|
2014-09-12 16:50:42 +02:00
|
|
|
*/
|
|
|
|
public function acknowledgeProblemAction()
|
|
|
|
{
|
2015-01-22 15:23:02 +01:00
|
|
|
$this->assertPermission('monitoring/command/acknowledge-problem');
|
|
|
|
|
2014-09-16 18:46:27 +02:00
|
|
|
$this->view->title = $this->translate('Acknowledge Service Problem');
|
2014-09-12 16:50:42 +02:00
|
|
|
$this->handleCommandForm(new AcknowledgeProblemCommandForm());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a service comment
|
|
|
|
*/
|
|
|
|
public function addCommentAction()
|
|
|
|
{
|
2015-01-22 16:56:00 +01:00
|
|
|
$this->assertPermission('monitoring/command/comment/add');
|
2015-01-22 15:23:02 +01:00
|
|
|
|
2014-09-12 16:50:42 +02:00
|
|
|
$this->view->title = $this->translate('Add Service Comment');
|
|
|
|
$this->handleCommandForm(new AddCommentCommandForm());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reschedule a service check
|
|
|
|
*/
|
|
|
|
public function rescheduleCheckAction()
|
|
|
|
{
|
2015-01-22 15:23:02 +01:00
|
|
|
$this->assertPermission('monitoring/command/schedule-check');
|
|
|
|
|
2014-09-12 16:50:42 +02:00
|
|
|
$this->view->title = $this->translate('Reschedule Service Check');
|
|
|
|
$this->handleCommandForm(new ScheduleServiceCheckCommandForm());
|
|
|
|
}
|
|
|
|
|
2014-09-04 15:43:37 +02:00
|
|
|
/**
|
|
|
|
* Schedule a service downtime
|
|
|
|
*/
|
|
|
|
public function scheduleDowntimeAction()
|
|
|
|
{
|
2015-01-22 16:56:00 +01:00
|
|
|
$this->assertPermission('monitoring/command/downtime/schedule');
|
2015-01-22 15:23:02 +01:00
|
|
|
|
2014-09-04 15:43:37 +02:00
|
|
|
$this->view->title = $this->translate('Schedule Service Downtime');
|
|
|
|
$this->handleCommandForm(new ScheduleServiceDowntimeCommandForm());
|
|
|
|
}
|
2014-12-11 15:52:23 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Submit a passive service check result
|
|
|
|
*/
|
|
|
|
public function processCheckResultAction()
|
|
|
|
{
|
2015-01-22 15:23:02 +01:00
|
|
|
$this->assertPermission('monitoring/command/process-check-result');
|
|
|
|
|
2014-12-11 15:52:23 +01:00
|
|
|
$this->view->title = $this->translate('Submit Passive Service Check Result');
|
|
|
|
$this->handleCommandForm(new ProcessCheckResultCommandForm());
|
|
|
|
}
|
2014-09-04 15:43:37 +02:00
|
|
|
}
|