Host services view

This commit is contained in:
Thomas Gelf 2014-03-08 00:00:21 +00:00
parent 269b93432d
commit d53573ede2
4 changed files with 31 additions and 15 deletions

View File

@ -167,6 +167,12 @@ class Monitoring_ListController extends MonitoringController
'title' => 'Services Status', 'title' => 'Services Status',
'url' => Url::fromPath('monitoring/list/services') 'url' => Url::fromPath('monitoring/list/services')
))->activate('services'); ))->activate('services');
$this->view->showHost = true;
if ($host = $this->_getParam('host')) {
if (strpos($host, '*') === false) {
$this->view->showHost = false;
}
}
$this->view->title = 'Service Status'; $this->view->title = 'Service Status';
$this->setAutorefreshInterval(10); $this->setAutorefreshInterval(10);
$query = $this->fetchServices(); $query = $this->fetchServices();

View File

@ -107,9 +107,12 @@ class Monitoring_ShowController extends Controller
public function servicesAction() public function servicesAction()
{ {
$this->getTabs()->activate('services'); $this->getTabs()->activate('services');
$params = $this->_request->getParams(); $this->_setParam('service', null);
unset($params['service']); $this->view->services = $this->view->action('services', 'list', 'monitoring', array(
$this->view->services = $this->fetchServices($params)->paginate(); 'view' => 'compact',
'limit' => '',
'sort' => 'service_description',
));
} }
@ -160,7 +163,21 @@ class Monitoring_ShowController extends Controller
$params['service'] = $object->service_description; $params['service'] = $object->service_description;
} elseif ($service = $this->_getParam('service')) { } elseif ($service = $this->_getParam('service')) {
$params['service'] = $service; $params['service'] = $service;
} elseif ($service = $this->_getParam('active_service')) {
$params['service'] = $service;
} }
$servicesParams = $params;
$servicesParams['active_service'] = $servicesParams['service'];
unset($servicesParams['service']);
$tabs->add(
'host',
array(
'title' => 'Host',
'icon' => 'img/icons/host.png',
'url' => 'monitoring/show/host',
'urlParams' => $params,
)
);
if (isset($params['service'])) { if (isset($params['service'])) {
$tabs->add( $tabs->add(
'service', 'service',
@ -172,22 +189,13 @@ class Monitoring_ShowController extends Controller
) )
); );
} }
$tabs->add(
'host',
array(
'title' => 'Host',
'icon' => 'img/icons/host.png',
'url' => 'monitoring/show/host',
'urlParams' => $params,
)
);
$tabs->add( $tabs->add(
'services', 'services',
array( array(
'title' => 'Services', 'title' => 'Services',
'icon' => 'img/icons/service.png', 'icon' => 'img/icons/service.png',
'url' => 'monitoring/show/services', 'url' => 'monitoring/show/services',
'urlParams' => $params, 'urlParams' => $servicesParams,
) )
); );
$tabs->add( $tabs->add(

View File

@ -82,11 +82,11 @@ foreach ($services as $service):
<?php if ($service->service_icon_image): ?> <?php if ($service->service_icon_image): ?>
<?= $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?> <?= $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
<?php endif ?> <?php endif ?>
<a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?> <a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a><?php if ($this->showHost): ?> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?>
<?php if ($service->host_state != 0): ?> <?php if ($service->host_state != 0): ?>
(<?= ucfirst($helper->monitoringState($service, 'host')); ?>) (<?= ucfirst($helper->monitoringState($service, 'host')); ?>)
<?php endif ?> <?php endif ?>
</a><br /> </a><?php endif ?><br />
<p class="pluginoutput"><?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?></p> <p class="pluginoutput"><?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?></p>
</td> </td>
</tr> </tr>

View File

@ -1,4 +1,6 @@
<div class="controls"> <div class="controls">
<?= $this->render('show/components/header.phtml') ?> <?= $this->render('show/components/header.phtml') ?>
</div> </div>
<div class="content">
<?= $services ?> <?= $services ?>
</div>