diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index aab3ccb0e..1a800aa5b 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -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', diff --git a/modules/monitoring/application/views/helpers/Perfdata.php b/modules/monitoring/application/views/helpers/Perfdata.php index f7ae4672f..eee779911 100644 --- a/modules/monitoring/application/views/helpers/Perfdata.php +++ b/modules/monitoring/application/views/helpers/Perfdata.php @@ -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 . ''; } } + if ($result == '') { + $result = $perfdata; + } if (! $compact && $result !== '') { $result = '' . $result . '
'; } + + + return $result; } } diff --git a/modules/monitoring/application/views/scripts/show/header.phtml b/modules/monitoring/application/views/scripts/show/header.phtml index 7a69b5535..a9d29fabe 100644 --- a/modules/monitoring/application/views/scripts/show/header.phtml +++ b/modules/monitoring/application/views/scripts/show/header.phtml @@ -1,6 +1,7 @@ service) && $this->tabs->getActiveName() !== 'host') { $showService = true; } @@ -30,9 +31,10 @@ if (!$this->compact) { + + host->host_action_url || $this->host->host_notes_url): ?> + + + + + + + service->service_action_url || $this->service->service_notes_url): ?> + +
- service->host_icon_image): ?> + + host->host_icon_image) : ?>
- Host image + Host image
@@ -55,6 +57,25 @@ if (!$this->compact) {
+ host->host_action_url): ?> + + Host actions + + + host->host_notes_url): ?> + + Host notes + + +
@@ -76,19 +97,25 @@ if (!$this->compact) {
+ service->service_action_url): ?> - Actions + Service actions + + service->service_notes_url): ?> - Notes + Service notes - +
diff --git a/modules/monitoring/application/views/scripts/show/service.phtml b/modules/monitoring/application/views/scripts/show/service.phtml index 8c6f20111..9bcf1021d 100644 --- a/modules/monitoring/application/views/scripts/show/service.phtml +++ b/modules/monitoring/application/views/scripts/show/service.phtml @@ -1,7 +1,8 @@ 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( service->service_perfdata): ?>
+
Perfdata
diff --git a/modules/monitoring/library/Monitoring/Backend/AbstractBackend.php b/modules/monitoring/library/Monitoring/Backend/AbstractBackend.php index 4eb32067a..e896def4f 100644 --- a/modules/monitoring/library/Monitoring/Backend/AbstractBackend.php +++ b/modules/monitoring/library/Monitoring/Backend/AbstractBackend.php @@ -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();