diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 093d0a841..a66e478a2 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -82,19 +82,14 @@ class Monitoring_HostsController extends Controller ->setRedirectUrl(Url::fromPath('monitoring/hosts/show')->setParams($this->params)) ->handleRequest(); - $hostStates = array( - Host::getStateText(Host::STATE_UP) => 0, - Host::getStateText(Host::STATE_DOWN) => 0, - Host::getStateText(Host::STATE_UNREACHABLE) => 0, - Host::getStateText(Host::STATE_PENDING) => 0, - ); - foreach ($this->hostList as $host) { - ++$hostStates[$host::getStateText($host->state)]; - } - $this->view->form = $form; $this->view->objects = $this->hostList; - $this->view->hostStates = $hostStates; + $this->view->stats = $this->hostList->getStateSummary(); + $this->view->hostStatesPieChart = InlinePie::createFromStateSummary( + $this->view->stats, + $this->translate('Host State'), + InlinePie::$colorsHostStatesHandledUnhandled + ); $this->_helper->viewRenderer('partials/command/objects-command-form', null, true); return $form; } diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index e37852fff..c8a406ca3 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -64,7 +64,10 @@ class Monitoring_ServicesController extends Controller { $this->serviceList->setColumns(array( 'host_name', + 'host_output', 'host_state', + 'host_problem', + 'host_handled', 'service_description', 'service_state', 'service_problem', @@ -83,32 +86,21 @@ class Monitoring_ServicesController extends Controller ->setRedirectUrl(Url::fromPath('monitoring/services/show')->setParams($this->params)) ->handleRequest(); - $serviceStates = array( - Service::getStateText(Service::STATE_OK) => 0, - Service::getStateText(Service::STATE_WARNING) => 0, - Service::getStateText(Service::STATE_CRITICAL) => 0, - Service::getStateText(Service::STATE_UNKNOWN) => 0, - Service::getStateText(Service::STATE_PENDING) => 0 - ); - $knownHostStates = array(); - $hostStates = array( - Host::getStateText(Host::STATE_UP) => 0, - Host::getStateText(Host::STATE_DOWN) => 0, - Host::getStateText(Host::STATE_UNREACHABLE) => 0, - Host::getStateText(Host::STATE_PENDING) => 0, - ); - foreach ($this->serviceList as $service) { - ++$serviceStates[$service::getStateText($service->state)]; - if (! isset($knownHostStates[$service->getHost()->getName()])) { - $knownHostStates[$service->getHost()->getName()] = true; - ++$hostStates[$service->getHost()->getStateText($service->host_state)]; - } - } - $this->view->form = $form; $this->view->objects = $this->serviceList; - $this->view->serviceStates = $serviceStates; - $this->view->hostStates = $hostStates; + $this->view->stats = $this->serviceList->getServiceStateSummary(); + $this->view->serviceStates = true; + $this->view->serviceStatesPieChart = InlinePie::createFromStateSummary( + $this->view->stats, + $this->translate('Service State'), + InlinePie::$colorsServiceStatesHandleUnhandled + ); + $this->view->hostStates = $this->serviceList->getHostStateSummary(); + $this->view->hostStatesPieChart = InlinePie::createFromStateSummary( + $this->view->hostStates, + $this->translate('Service State'), + InlinePie::$colorsHostStatesHandledUnhandled + ); $this->_helper->viewRenderer('partials/command/objects-command-form', null, true); return $form; } @@ -168,15 +160,6 @@ class Monitoring_ServicesController extends Controller $this->translate('Host State'), InlinePie::$colorsHostStatesHandledUnhandled ); - /* - if (! empty($objectsInDowntime)) { - $removeDowntimeForm = new DeleteDowntimeCommandForm(); - $removeDowntimeForm - ->setObjects($objectsInDowntime) - ->handleRequest(); - $this->view->removeDowntimeForm = $removeDowntimeForm; - } - */ $this->setAutorefreshInterval(15); $this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check'); $this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime'); diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 656cf9f47..2fcfbc448 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -5,13 +5,6 @@ render('list/components/hostssummary.phtml') ?> - -
-
- translate('States:') ?> -   -
- render('partials/host/objects-header.phtml'); ?> diff --git a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml index 418a64906..3ecb2279a 100644 --- a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml @@ -12,7 +12,6 @@ function urlAddFilterOptional($url, $filter, $optional) { return $url->setQueryString($f->toQueryString()); } $this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null; - $selfUrl = 'monitoring/list/hosts'; $currentUrl = Url::fromRequest()->getRelativeUrl(); ?>
compact ? ' data-base-target="col1"' : ''; ?>> diff --git a/modules/monitoring/application/views/scripts/partials/command/objects-command-form.phtml b/modules/monitoring/application/views/scripts/partials/command/objects-command-form.phtml index ece0aea34..42c6e73cd 100644 --- a/modules/monitoring/application/views/scripts/partials/command/objects-command-form.phtml +++ b/modules/monitoring/application/views/scripts/partials/command/objects-command-form.phtml @@ -5,10 +5,10 @@ -

translate('%d Services Selected'), count($objects)) ?>

+ render('list/components/servicesummary.phtml') ?> render('partials/service/objects-header.phtml'); ?> -

translate('%d Hosts Selected'), count($objects)) ?>

+ render('list/components/hostssummary.phtml') ?> render('partials/host/objects-header.phtml'); ?>
diff --git a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml index 0b20cc766..f6ea43d84 100644 --- a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml @@ -8,6 +8,11 @@ $hidden = array(); $hiddenRich = array(); ?> +
+ translate('States:') ?> +   +
+ 0): ?>

@@ -61,7 +66,8 @@ $hiddenRich = array(); -

title=""> qlink( diff --git a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml index 57d1b67e6..3880e4473 100644 --- a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml @@ -2,6 +2,15 @@ use Icinga\Module\Monitoring\Object\Service; ?> +
+ translate('Service states:') ?> +   +
+
+ translate('Host states:') ?> +   +
+ 5) { + if ($i > 5 && $i < 20) { $desc = $service->getName() . ' on ' . $service->getHost()->getName(); $hidden[] = $desc; $hiddenRich[] = sprintf("
%s", $service->getStateText($service->service_state) ,$desc); + } + if ($i == 20) { + $hiddenRich[] = '...'; + } + if ($i > 5) { continue; } ?> service_state, true); ?>
- - service_handled && $service->service_state > 0): ?> icon('attention-alt', $this->translate('Unhandled')) ?> @@ -52,7 +64,6 @@ use Icinga\Module\Monitoring\Object\Service; service_last_comment) && $service->service_last_comment !== null): ?> icon('comment', $this->translate('Last Comment: ') . $service->service_last_comment) ?> - escape($service->getName()); ?> escape($service->getHost()->getName()); ?> @@ -62,7 +73,8 @@ use Icinga\Module\Monitoring\Object\Service; -
title=""> render('list/components/servicesummary.phtml') ?> -
-
- translate('Service states:') ?> -   -
-
- translate('Host states:') ?> -   -
- render('partials/service/objects-header.phtml'); ?>
diff --git a/public/css/icinga/layout-structure.less b/public/css/icinga/layout-structure.less index 3aa7da077..ee531d354 100644 --- a/public/css/icinga/layout-structure.less +++ b/public/css/icinga/layout-structure.less @@ -345,6 +345,7 @@ html { .hbox-item { display: inline-block; vertical-align: top; + margin-top: 0.5em; margin-bottom: 0.25em; margin-left: 1em; margin-right: 1em;