Add servicegroup and icon image to service overview
Add icon images for hosts and services, notes and action url for hosts refs #4181
This commit is contained in:
parent
a0839ea0da
commit
4ededd5179
|
@ -79,17 +79,30 @@ class Monitoring_ShowController extends ModuleActionController
|
|||
|
||||
if ($grapher = Hook::get('grapher')) {
|
||||
if ($grapher->hasGraph(
|
||||
$this->view->host->host_name,
|
||||
$this->view->service->host_name,
|
||||
$this->view->service->service_description
|
||||
)
|
||||
) {
|
||||
$this->view->preview_image = $grapher->getPreviewImage(
|
||||
$this->view->host->host_name,
|
||||
$this->view->service->host_name,
|
||||
$this->view->service->service_description
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->servicegroups = $this->backend->select()
|
||||
->from(
|
||||
'servicegroup',
|
||||
array(
|
||||
'servicegroup_name',
|
||||
'servicegroup_alias'
|
||||
)
|
||||
)
|
||||
->where('host_name', $this->view->host->host_name)
|
||||
->where('service_description', $this->view->service->service_description)
|
||||
|
||||
->fetchPairs();
|
||||
|
||||
$this->view->contacts = $this->backend->select()
|
||||
->from(
|
||||
'contact',
|
||||
|
@ -350,15 +363,17 @@ class Monitoring_ShowController extends ModuleActionController
|
|||
'urlParams' => $hostParams,
|
||||
)
|
||||
);
|
||||
$tabs->add(
|
||||
'services',
|
||||
array(
|
||||
'title' => 'Services',
|
||||
'icon' => 'img/classic/service.png',
|
||||
'url' => 'monitoring/show/services',
|
||||
'urlParams' => $params,
|
||||
)
|
||||
);
|
||||
if (!isset($this->view->service)) {
|
||||
$tabs->add(
|
||||
'services',
|
||||
array(
|
||||
'title' => 'Services',
|
||||
'icon' => 'img/classic/service.png',
|
||||
'url' => 'monitoring/show/services',
|
||||
'urlParams' => $params,
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isset($params['service'])) {
|
||||
$tabs->add(
|
||||
'service',
|
||||
|
|
|
@ -6,6 +6,7 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
|
|||
{
|
||||
public function perfdata($perfdata, $compact = false, $float = 'right')
|
||||
{
|
||||
|
||||
if (empty($perfdata)) {
|
||||
return '';
|
||||
}
|
||||
|
@ -75,9 +76,15 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
|
|||
. '</td></tr>';
|
||||
}
|
||||
}
|
||||
if ($result == '') {
|
||||
$result = $perfdata;
|
||||
}
|
||||
if (! $compact && $result !== '') {
|
||||
$result = '<table style="width: 100%">' . $result . '</table>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/** @var boolean $showService */
|
||||
$showService = false;
|
||||
|
||||
if (isset($this->service) && $this->tabs->getActiveName() !== 'host') {
|
||||
$showService = true;
|
||||
}
|
||||
|
@ -30,9 +31,10 @@ if (!$this->compact) {
|
|||
<table>
|
||||
<tr class="<?= $this->monitoringState($this->host, 'host') ?><?= $this->host->host_handled ? ' handled' : '' ?>">
|
||||
<td>
|
||||
<?php if ($this->service->host_icon_image): ?>
|
||||
|
||||
<?php if ($this->host->host_icon_image) : ?>
|
||||
<div class="monitoring_icon">
|
||||
<img src="<?= $this->service->host_icon_image; ?>" alt="Host image" />
|
||||
<img src="<?= $this->host->host_icon_image; ?>" alt="Host image" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<strong>
|
||||
|
@ -55,6 +57,25 @@ if (!$this->compact) {
|
|||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ($this->host->host_action_url || $this->host->host_notes_url): ?>
|
||||
<tr>
|
||||
<td class="urls" rowspan="2">
|
||||
<?php if ($this->host->host_action_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->host->host_notes_url ?>'>Host actions </a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->host->host_notes_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->host->host_notes_url ?>'>Host notes </a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if ($showService === true): ?>
|
||||
<tr class="<?= $this->monitoringState($this->service, 'service'); ?><?= $this->service->service_handled ? ' handled' : '' ?>">
|
||||
<td>
|
||||
|
@ -76,19 +97,25 @@ if (!$this->compact) {
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php if ($this->service->service_action_url || $this->service->service_notes_url): ?>
|
||||
<tr>
|
||||
<td class="urls" rowspan="2">
|
||||
<?php if ($this->service->service_action_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->service->service_notes_url ?>'>Actions </a>
|
||||
<a href='<?= $this->service->service_notes_url ?>'>Service actions </a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->service->service_notes_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->service->service_notes_url ?>'>Notes </a>
|
||||
<a href='<?= $this->service->service_notes_url ?>'>Service notes </a>
|
||||
</span>
|
||||
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<div class="clearfix"></div>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
$servicegroupLinkList = array();
|
||||
if (!empty($this->hostgroups)) {
|
||||
foreach ($this->hostgroups as $name => $alias) {
|
||||
if (!empty($this->servicegroups)) {
|
||||
foreach ($this->servicegroups as $name => $alias) {
|
||||
$servicegroupLinkList[] = $this->qlink(
|
||||
$alias,
|
||||
'monitoring/list/services',
|
||||
|
@ -68,6 +69,7 @@ $this->partial(
|
|||
|
||||
<?php if ($this->service->service_perfdata): ?>
|
||||
<div class="information-container">
|
||||
|
||||
<div class="head">
|
||||
<span>Perfdata</span>
|
||||
</div>
|
||||
|
|
|
@ -98,6 +98,7 @@ class AbstractBackend implements DatasourceInterface
|
|||
'host_address',
|
||||
'host_state',
|
||||
'host_handled',
|
||||
'host_icon_image',
|
||||
'host_in_downtime',
|
||||
'host_acknowledged',
|
||||
'host_check_command',
|
||||
|
@ -105,7 +106,9 @@ class AbstractBackend implements DatasourceInterface
|
|||
'host_alias',
|
||||
'host_output',
|
||||
'host_long_output',
|
||||
'host_perfdata'
|
||||
'host_perfdata',
|
||||
'host_notes_url',
|
||||
'host_action_url'
|
||||
);
|
||||
|
||||
if ($fetchAll === true) {
|
||||
|
@ -236,6 +239,7 @@ class AbstractBackend implements DatasourceInterface
|
|||
|
||||
$select = $this->select()
|
||||
->from('status', $fields)
|
||||
->where('service_description', $service)
|
||||
->where('host_name', $host);
|
||||
return $select->fetchRow();
|
||||
|
||||
|
|
Loading…
Reference in New Issue