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',
'url' => Url::fromPath('monitoring/list/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->setAutorefreshInterval(10);
$query = $this->fetchServices();

View File

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

View File

@ -82,11 +82,11 @@ foreach ($services as $service):
<?php if ($service->service_icon_image): ?>
<?= $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
<?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): ?>
(<?= ucfirst($helper->monitoringState($service, 'host')); ?>)
<?php endif ?>
</a><br />
</a><?php endif ?><br />
<p class="pluginoutput"><?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?></p>
</td>
</tr>

View File

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