2014-09-04 15:43:37 +02:00
|
|
|
<?php
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
2014-11-14 11:17:22 +01:00
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm;
|
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm;
|
|
|
|
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'));
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a service
|
|
|
|
*/
|
|
|
|
public function showAction()
|
|
|
|
{
|
|
|
|
$this->getTabs()->activate('service');
|
|
|
|
parent::showAction();
|
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()
|
|
|
|
{
|
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()
|
|
|
|
{
|
|
|
|
$this->view->title = $this->translate('Add Service Comment');
|
|
|
|
$this->handleCommandForm(new AddCommentCommandForm());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reschedule a service check
|
|
|
|
*/
|
|
|
|
public function rescheduleCheckAction()
|
|
|
|
{
|
|
|
|
$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()
|
|
|
|
{
|
|
|
|
$this->view->title = $this->translate('Schedule Service Downtime');
|
|
|
|
$this->handleCommandForm(new ScheduleServiceDowntimeCommandForm());
|
|
|
|
}
|
|
|
|
}
|