From fb8fbbe8f77eec180a27de00331e479d936ed017 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 27 Aug 2015 16:28:32 +0200 Subject: [PATCH 01/17] Provide new dashboard panes per default refs #6144 --- modules/monitoring/configuration.php | 87 +++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index fa95c3785..467a5a1ad 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -225,7 +225,7 @@ $section->add($this->translate('Monitoring Health'), array( )); /* - * Dashboard + * Current Incidents */ $dashboard = $this->dashboard($this->translate('Current Incidents')); $dashboard->add( @@ -240,3 +240,88 @@ $dashboard->add( $this->translate('Host Problems'), 'monitoring/list/hosts?host_problem=1&sort=host_severity' ); + +/* + * Overview + */ +$dashboard = $this->dashboard($this->translate('Overview')); +$dashboard->add( + $this->translate('Service Grid'), + 'monitoring/list/servicegrid?limit=15,18' +); +$dashboard->add( + $this->translate('Service Groups'), + '/monitoring/list/servicegroups' +); +$dashboard->add( + $this->translate('Host Groups'), + '/monitoring/list/hostgroups' +); + +/* + * Most Overdue + */ +$dashboard = $this->dashboard($this->translate('Overdue')); +$dashboard->add( + $this->translate('Acks Older Than Three Days'), + 'monitoring/list/comments?comment_type=Ack&comment_timestamp<-3 days' +); +$dashboard->add( + $this->translate('Downtimes Older Than Three Days'), + 'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc' +); +$dashboard->add( + $this->translate('Oldest Sticky Comments'), + 'monitoring/list/comments?comment_type=Ack&TODO' +); + +/* + * Muted Objects + */ +$dashboard = $this->dashboard($this->translate('Muted Objects')); +$dashboard->add( + $this->translate('Disabled Service Notifications'), + 'monitoring/list/services?service_notifications_enabled=0&limit=10' +); +$dashboard->add( + $this->translate('Disabled Host Notifications'), + 'monitoring/list/hosts?host_notifications_enabled=0&limit=10' +); +$dashboard->add( + $this->translate('Disabled Service Checks'), + 'monitoring/list/services?service_active_checks_enabled=0&limit=10' +); +$dashboard->add( + $this->translate('Disabled Host Checks'), + 'monitoring/list/hosts?host_active_checks_enabled=0&limit=10' +); + +/* + * Activity Stream + */ +$dashboard = $this->dashboard($this->translate('Activity Stream')); +$dashboard->add( + $this->translate('Todays Events'), + 'monitoring/list/eventhistory?timestamp>=-1%20days&sort=timestamp&dir=desc&limit=8' +); +$dashboard->add( + $this->translate('Hard State Changed'), + 'monitoring/list/eventhistory?type=hard_state&sort=timestamp&dir=desc&limit=8' +); +$dashboard->add( + $this->translate('Critical Event Grid'), + 'monitoring/list/eventgrid' +); +$dashboard->add( + $this->translate('Downtimes Started'), + 'monitoring/list/eventhistory?type=dt_start&sort=timestamp&dir=desc&limit=8' +); +$dashboard->add( + $this->translate('Downtimes Ended'), + 'monitoring/list/eventhistory?type=dt_end&sort=timestamp&dir=desc&limit=8' +); +$dashboard->add( + $this->translate('Notifications'), + 'monitoring/list/eventhistory?type=notify&sort=timestamp&dir=desc&limit=8' +); + From 39513587d9dbdc43a9671c9e2c7857a62eeaf285 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 27 Aug 2015 17:13:22 +0200 Subject: [PATCH 02/17] Remove event grid from activity stream refs #6144 --- modules/monitoring/configuration.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 467a5a1ad..d7f263e5c 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -308,10 +308,6 @@ $dashboard->add( $this->translate('Hard State Changed'), 'monitoring/list/eventhistory?type=hard_state&sort=timestamp&dir=desc&limit=8' ); -$dashboard->add( - $this->translate('Critical Event Grid'), - 'monitoring/list/eventgrid' -); $dashboard->add( $this->translate('Downtimes Started'), 'monitoring/list/eventhistory?type=dt_start&sort=timestamp&dir=desc&limit=8' From fa93b7e37267a42bbe39f1bcb1233b48611d311a Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 27 Aug 2015 17:15:15 +0200 Subject: [PATCH 03/17] Move notifications up to avoid breaks between related dashlets refs #6144 --- modules/monitoring/configuration.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index d7f263e5c..8740575ba 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -308,6 +308,10 @@ $dashboard->add( $this->translate('Hard State Changed'), 'monitoring/list/eventhistory?type=hard_state&sort=timestamp&dir=desc&limit=8' ); +$dashboard->add( + $this->translate('Notifications'), + 'monitoring/list/eventhistory?type=notify&sort=timestamp&dir=desc&limit=8' +); $dashboard->add( $this->translate('Downtimes Started'), 'monitoring/list/eventhistory?type=dt_start&sort=timestamp&dir=desc&limit=8' @@ -316,8 +320,3 @@ $dashboard->add( $this->translate('Downtimes Ended'), 'monitoring/list/eventhistory?type=dt_end&sort=timestamp&dir=desc&limit=8' ); -$dashboard->add( - $this->translate('Notifications'), - 'monitoring/list/eventhistory?type=notify&sort=timestamp&dir=desc&limit=8' -); - From 6ada9ce047b5ecb4778204c1a64511260fba7b68 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 31 Aug 2015 17:03:10 +0200 Subject: [PATCH 04/17] Provide dashlets for sticky-comments refs #6144 --- .../monitoring/application/controllers/ListController.php | 1 + modules/monitoring/configuration.php | 8 ++++++-- .../monitoring/library/Monitoring/DataView/Hoststatus.php | 3 ++- .../library/Monitoring/DataView/Servicestatus.php | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 44172f1ea..f30432686 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -155,6 +155,7 @@ class Monitoring_ListController extends Controller 'service_notes_url', 'service_active_checks_enabled', 'service_passive_checks_enabled', + 'service_acknowledgement_type', 'current_check_attempt' => 'service_current_check_attempt', 'max_check_attempts' => 'service_max_check_attempts' ), $this->addColumns()); diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 8740575ba..e1a8d58d2 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -271,8 +271,12 @@ $dashboard->add( 'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc' ); $dashboard->add( - $this->translate('Oldest Sticky Comments'), - 'monitoring/list/comments?comment_type=Ack&TODO' + $this->translate('Host Sticky Acknowledgements Older Than Three Days'), + '/monitoring/list/hosts?host_acknowledgement_type=2&host_last_state_change<-3%20days' +); +$dashboard->add( + $this->translate('Service Sticky Acknowledgements, Older Than Three Days'), + '/monitoring/list/services?service_acknowledgement_type=2&service_last_state_change<-3%20days' ); /* diff --git a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php index 05385763c..413f175f1 100644 --- a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php @@ -58,7 +58,8 @@ class HostStatus extends DataView 'host_modified_host_attributes', 'host_severity', 'host_problem', - 'host_ipv4' + 'host_ipv4', + 'host_acknowledgement_type' ); } diff --git a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php index ff68474f1..f12c66535 100644 --- a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php @@ -92,7 +92,8 @@ class ServiceStatus extends DataView 'service_flap_detection_enabled', 'service_flap_detection_enabled_changed', 'service_modified_service_attributes', - 'service_host_name' + 'service_host_name', + 'service_acknowledgement_type' ); } From 1964cc53d56b60fc93bd099b32e75a81a629d965 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 1 Sep 2015 17:59:04 +0200 Subject: [PATCH 05/17] Revert "Provide dashlets for sticky-comments" This reverts commit 6ada9ce047b5ecb4778204c1a64511260fba7b68. --- .../monitoring/application/controllers/ListController.php | 1 - modules/monitoring/configuration.php | 8 ++------ .../monitoring/library/Monitoring/DataView/Hoststatus.php | 3 +-- .../library/Monitoring/DataView/Servicestatus.php | 3 +-- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index f30432686..44172f1ea 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -155,7 +155,6 @@ class Monitoring_ListController extends Controller 'service_notes_url', 'service_active_checks_enabled', 'service_passive_checks_enabled', - 'service_acknowledgement_type', 'current_check_attempt' => 'service_current_check_attempt', 'max_check_attempts' => 'service_max_check_attempts' ), $this->addColumns()); diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index e1a8d58d2..8740575ba 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -271,12 +271,8 @@ $dashboard->add( 'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc' ); $dashboard->add( - $this->translate('Host Sticky Acknowledgements Older Than Three Days'), - '/monitoring/list/hosts?host_acknowledgement_type=2&host_last_state_change<-3%20days' -); -$dashboard->add( - $this->translate('Service Sticky Acknowledgements, Older Than Three Days'), - '/monitoring/list/services?service_acknowledgement_type=2&service_last_state_change<-3%20days' + $this->translate('Oldest Sticky Comments'), + 'monitoring/list/comments?comment_type=Ack&TODO' ); /* diff --git a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php index 413f175f1..05385763c 100644 --- a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php @@ -58,8 +58,7 @@ class HostStatus extends DataView 'host_modified_host_attributes', 'host_severity', 'host_problem', - 'host_ipv4', - 'host_acknowledgement_type' + 'host_ipv4' ); } diff --git a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php index f12c66535..ff68474f1 100644 --- a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php @@ -92,8 +92,7 @@ class ServiceStatus extends DataView 'service_flap_detection_enabled', 'service_flap_detection_enabled_changed', 'service_modified_service_attributes', - 'service_host_name', - 'service_acknowledgement_type' + 'service_host_name' ); } From ca33e71f2d62ca6419787578efe71284366d867a Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 13:02:57 +0200 Subject: [PATCH 06/17] Deduplicate and clean up service summary component Remove redundant component view script and streamline subFilter handling in all views that render it. Remove heading from component to allow embedding in different types of views. refs #10033 --- library/Icinga/Web/Url.php | 22 ++- .../views/scripts/host/services.phtml | 10 +- .../application/views/scripts/host/show.phtml | 10 +- .../views/scripts/hosts/show.phtml | 4 +- .../list/components/hostssummary.phtml | 29 ++-- .../list/components/servicesummary.phtml | 26 ++- .../views/scripts/list/hosts.phtml | 4 +- .../views/scripts/list/services.phtml | 4 +- .../command/object-command-form.phtml | 10 +- .../command/objects-command-form.phtml | 10 +- .../partials/host/servicesummary.phtml | 150 ------------------ .../views/scripts/services/show.phtml | 5 +- 12 files changed, 91 insertions(+), 193 deletions(-) delete mode 100644 modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml diff --git a/library/Icinga/Web/Url.php b/library/Icinga/Web/Url.php index 7c3829537..237c8988a 100644 --- a/library/Icinga/Web/Url.php +++ b/library/Icinga/Web/Url.php @@ -6,7 +6,7 @@ namespace Icinga\Web; use Icinga\Application\Icinga; use Icinga\Cli\FakeRequest; use Icinga\Exception\ProgrammingError; -use Icinga\Web\UrlParams; +use Icinga\Data\Filter\Filter; /** * Url class that provides convenient access to parameters, allows to modify query parameters and @@ -156,6 +156,26 @@ class Url return $urlObject; } + /** + * Create a new filter that needs to fullfill the base filter and the optional filter (if it exists) + * + * @param string $url The url to apply the new filter to + * @param Filter $filter The base filter + * @param Filter $optional The optional filter + * + * @return Url The altered URL containing the new filter + * @throws ProgrammingError + */ + public static function urlAddFilterOptional($url, $filter, $optional) + { + $url = Url::fromPath($url); + $f = $filter; + if (isset($optional)) { + $f = Filter::matchAll($filter, $optional); + } + return $url->setQueryString($f->toQueryString()); + } + /** * Overwrite the baseUrl * diff --git a/modules/monitoring/application/views/scripts/host/services.phtml b/modules/monitoring/application/views/scripts/host/services.phtml index 11166f8fa..fd69d88ad 100644 --- a/modules/monitoring/application/views/scripts/host/services.phtml +++ b/modules/monitoring/application/views/scripts/host/services.phtml @@ -1,9 +1,17 @@ + +
compact): ?> tabs; ?> render('partials/host/object-header.phtml') ?> - render('partials/host/servicesummary.phtml') ?> +

compact ? ' data-base-target="col1"' : ''; ?> + baseFilter = Filter::where('host', $object->host_name); + $this->stats = $object->stats; + echo $this->render('list/components/servicesummary.phtml'); + ?> +

partial( 'list/services.phtml', diff --git a/modules/monitoring/application/views/scripts/host/show.phtml b/modules/monitoring/application/views/scripts/host/show.phtml index a612ae1af..12de39a78 100644 --- a/modules/monitoring/application/views/scripts/host/show.phtml +++ b/modules/monitoring/application/views/scripts/host/show.phtml @@ -1,9 +1,17 @@ + +
compact): ?> tabs; ?> render('partials/host/object-header.phtml') ?> - render('partials/host/servicesummary.phtml') ?> +

compact ? ' data-base-target="col1"' : ''; ?>> + stats = $object->stats; + $this->baseFilter = Filter::where('host', $object->host_name); + echo $this->render('list/components/servicesummary.phtml'); + ?> +

render('show/components/output.phtml') ?> diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 3dbb0673f..053c44520 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -3,7 +3,9 @@ - render('list/components/hostssummary.phtml') ?> +

compact ? ' data-base-target="col1"' : ''; ?> + render('list/components/hostssummary.phtml') ?> +

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 22f84b583..3fe11bcca 100644 --- a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml @@ -3,20 +3,16 @@ use Icinga\Web\Url; use Icinga\Data\Filter\Filter; -function urlAddFilterOptional($url, $filter, $optional) { - $url = Url::fromPath($url); - $f = $filter; - if (isset($optional)) { - $f = Filter::matchAll($filter, $optional); - } - return $url->setQueryString($f->toQueryString()); -} $this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null; -$stats = $stats->fetchRow(); +// don't fetch rows until they are actually needed to improve dashlet performance +if (!$stats instanceof stdClass) { + $stats = $stats->fetchRow(); +} + $selfUrl = 'monitoring/list/hosts'; $currentUrl = Url::fromRequest()->getRelativeUrl(); -?>

compact ? ' data-base-target="col1"' : ''; ?>> +?> qlink( sprintf($this->translatePlural('%u Host', '%u Hosts', $stats->hosts_total), $stats->hosts_total), $selfUrl, @@ -31,7 +27,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); qlink( $stats->hosts_up, - urlAddFilterOptional( + Url::urlAddFilterOptional( $selfUrl, Filter::where('host_state', 0), $this->baseFilter @@ -54,7 +50,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); qlink( $stats->hosts_down_unhandled, - urlAddFilterOptional( + Url::urlAddFilterOptional( $selfUrl, Filter::matchAll(Filter::where('host_state', 1), Filter::where('host_unhandled', 1)), $this->baseFilter @@ -75,7 +71,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); qlink( $stats->hosts_down_handled, - urlAddFilterOptional( + Url::urlAddFilterOptional( $selfUrl, Filter::matchAll(Filter::where('host_state', 1), Filter::where('host_unhandled', 0)), $this->baseFilter @@ -101,7 +97,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); qlink( $stats->hosts_unreachable_unhandled, - urlAddFilterOptional( + Url::urlAddFilterOptional( $selfUrl, Filter::matchAll(Filter::where('host_state', 2), Filter::where('host_unhandled', 1)), $this->baseFilter @@ -122,7 +118,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); qlink( $stats->hosts_unreachable_handled, - urlAddFilterOptional( + Url::urlAddFilterOptional( $selfUrl, Filter::matchAll(Filter::where('host_state', 2), Filter::where('host_unhandled', 0)), $this->baseFilter @@ -148,7 +144,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); qlink( $stats->hosts_pending, - urlAddFilterOptional( + Url::urlAddFilterOptional( $selfUrl, Filter::where('host_state', 99), $this->baseFilter @@ -166,4 +162,3 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); -

diff --git a/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml index 9fd798a0d..1f401004d 100644 --- a/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml @@ -4,21 +4,16 @@ use Icinga\Data\Filter\Filter; use Icinga\Web\Url; use Icinga\Module\Monitoring\Object\Service; -function urlAddFilterOptional($url, $filter, $optional) { - $url = Url::fromPath($url); - $f = $filter; - if (isset($optional)) { - $f = Filter::matchAll($filter, $optional); - } - return $url->setQueryString($f->toQueryString()); -} $this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null; -$stats = $stats->fetchRow(); +// don't fetch rows until they are actually needed, to improve dashlet performance +if (!$stats instanceof stdClass) { + $stats = $stats->fetchRow(); +}; $selfUrl = 'monitoring/list/services'; $currentUrl = Url::fromRequest()->getRelativeUrl(); -?>

compact ? ' data-base-target="col1"' : ''; ?>> -qlink( + +echo $this->qlink( sprintf($this->translatePlural( '%u Service', '%u Services', $stats->services_total), $stats->services_total @@ -36,7 +31,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); qlink( $stats->services_ok, - urlAddFilterOptional($selfUrl, Filter::where('service_state', 0), $this->baseFilter), + Url::urlAddFilterOptional($selfUrl, Filter::where('service_state', 0), $this->baseFilter), null, array('title' => sprintf( $this->translatePlural( @@ -81,7 +76,7 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ echo $this->qlink( $stats->$unhandled, - urlAddFilterOptional($selfUrl, $paramsUnhandled, $this->baseFilter), + Url::urlAddFilterOptional($selfUrl, $paramsUnhandled, $this->baseFilter), null, array('title' => sprintf( $this->translatePlural( @@ -106,7 +101,7 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ } echo $this->qlink( $stats->$handled, - urlAddFilterOptional($selfUrl, $paramsHandled, $this->baseFilter), + Url::urlAddFilterOptional($selfUrl, $paramsHandled, $this->baseFilter), null, array('title' => sprintf( $this->translatePlural( @@ -130,7 +125,7 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ qlink( $stats->services_pending, - urlAddFilterOptional($selfUrl, Filter::where('service_state', 99), $this->baseFilter), + Url::urlAddFilterOptional($selfUrl, Filter::where('service_state', 99), $this->baseFilter), null, array('title' => sprintf( $this->translatePlural( @@ -144,4 +139,3 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ -

diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 62ca65121..859f01aec 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -8,7 +8,9 @@ if (! $this->compact): ?> tabs; ?>
render('list/components/selectioninfo.phtml'); ?> - render('list/components/hostssummary.phtml'); ?> +

compact ? ' data-base-target="col1"' : ''; ?> + render('list/components/hostssummary.phtml'); ?> +

sortBox; ?> limiter; ?> diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index d2dfb250a..9b5dd1ec1 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -10,7 +10,9 @@ if (! $this->compact): ?> tabs ?>
render('list/components/selectioninfo.phtml') ?> - render('list/components/servicesummary.phtml') ?> +

compact ? ' data-base-target="col1"' : ''; ?>> + render('list/components/servicesummary.phtml') ?> +

sortBox ?> limiter ?> diff --git a/modules/monitoring/application/views/scripts/partials/command/object-command-form.phtml b/modules/monitoring/application/views/scripts/partials/command/object-command-form.phtml index ab14b1b2a..095d9a4c4 100644 --- a/modules/monitoring/application/views/scripts/partials/command/object-command-form.phtml +++ b/modules/monitoring/application/views/scripts/partials/command/object-command-form.phtml @@ -1,10 +1,18 @@ + +
compact): ?> tabs; ?> getType() === $object::TYPE_HOST): ?> render('partials/host/object-header.phtml'); ?> - render('partials/host/servicesummary.phtml'); ?> +

compact ? ' data-base-target="col1"' : ''; ?>"> + baseFilter = Filter::where('host', $object->host_name); + $this->stats = $object->stats; + echo $this->render('list/components/servicesummary.phtml'); + ?> +

render('partials/service/object-header.phtml'); ?>
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 42c6e73cd..6a209e159 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 @@ -1,3 +1,5 @@ + +
compact): ?> @@ -5,10 +7,14 @@ - render('list/components/servicesummary.phtml') ?> +

compact ? ' data-base-target="col1"' : ''; ?> + render('list/components/servicesummary.phtml'); ?> +

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

compact ? ' data-base-target="col1"' : ''; ?> + render('list/components/hostssummary.phtml') ?> +

render('partials/host/objects-header.phtml'); ?>
diff --git a/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml b/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml deleted file mode 100644 index be146acbe..000000000 --- a/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml +++ /dev/null @@ -1,150 +0,0 @@ -setQueryString($f->toQueryString()); -} - -$selfUrl = Url::fromPath('monitoring/list/services', array('host' => $object->host_name)); -?>

compact ? ' data-base-target="col1"' : ''; ?>> -stats->services_total): ?> -qlink( - sprintf( - $this->translatePlural( - '%u configured service:', - '%u configured services:', - $object->stats->services_total - ), - $object->stats->services_total - ), - $selfUrl, - null, - array( - 'title' => sprintf( - $this->translatePlural( - 'List all %u service on host %s', - 'List all %u services on host %s', - $object->stats->services_total - ), - $object->stats->services_total, - $object->host_name - ), - 'data-base-target' => '_next' - ) -); ?> - -translate('No services configured on this host'); ?> - - - -stats->services_ok): ?> - - qlink( - $object->stats->services_ok, - $selfUrl, - array('service_state' => 0), - array( - 'title' => sprintf( - $this->translatePlural( - 'List %u service that is currently in state OK on host %s', - 'List %u services which are currently in state OK on host %s', - $object->stats->services_ok - ), - $object->stats->services_ok, - $object->host_name - ), - 'data-base-target' => '_next' - ) - ); ?> - - - 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) { - $pre = 'services_' . $state; - if ($object->stats->$pre) { - $handled = $pre . '_handled'; - $unhandled = $pre . '_unhandled'; - $paramsHandled = array('service_state' => $stateId, 'service_handled' => 1); - $paramsUnhandled = array('service_state' => $stateId, 'service_handled' => 0); - echo ''; - if ($object->stats->$unhandled) { - - echo $this->qlink( - $object->stats->$unhandled, - $selfUrl, - $paramsUnhandled, - array( - 'title' => sprintf( - $this->translatePlural( - 'List %u service that is currently in state %s on host %s', - 'List %u services which are currently in state %s on host %s', - $object->stats->$unhandled - ), - $object->stats->$unhandled, - Service::getStateText($stateId, true), - $object->host_name - ), - 'data-base-target' => '_next' - ) - ); - } - if ($object->stats->$handled) { - if ($object->stats->$unhandled) { - echo ''; - } - echo $this->qlink( - $object->stats->$handled, - $selfUrl, - $paramsHandled, - array( - 'title' => sprintf( - $this->translatePlural( - 'List %u service that is currently in state %s (Acknowledged) on host %s', - 'List %u services which are currently in state %s (Acknowledged) on host %s', - $object->stats->$handled - ), - $object->stats->$handled, - Service::getStateText($stateId, true), - $object->host_name - ), - 'data-base-target' => '_next' - ) - ); - if ($object->stats->$unhandled) { - echo "\n"; - } - } - echo "\n"; - } -} -?> -stats->services_pending): ?> - - qlink( - $object->stats->services_pending, - $selfUrl, - array('service_state' => 99), - array( - 'title' => sprintf( - $this->translatePlural( - 'List %u service that is currently in state PENDING on host %s', - 'List %u services which are currently in state PENDING on host %s', - $object->stats->services_pending - ), - $object->stats->services_pending, - $object->host_name - ), - 'data-base-target' => '_next' - ) - ) ?> - - - -

diff --git a/modules/monitoring/application/views/scripts/services/show.phtml b/modules/monitoring/application/views/scripts/services/show.phtml index d2ad21bca..be8cf5a8b 100644 --- a/modules/monitoring/application/views/scripts/services/show.phtml +++ b/modules/monitoring/application/views/scripts/services/show.phtml @@ -4,7 +4,10 @@ - render('list/components/servicesummary.phtml') ?> + +

compact ? ' data-base-target="col1"' : ''; ?> + render('list/components/servicesummary.phtml') ?> +

render('partials/service/objects-header.phtml'); ?>
From daa23a4edd45646ce65e39aa53b1da5d78cdc2f1 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 13:06:13 +0200 Subject: [PATCH 07/17] Use correct filters in multi-object command views --- modules/monitoring/application/controllers/HostsController.php | 2 +- .../monitoring/application/controllers/ServicesController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 036b78c32..3c576fbc8 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -32,6 +32,7 @@ class HostsController extends Controller $this->applyRestriction('monitoring/filter/objects', $hostList); $hostList->addFilter(Filter::fromQueryString((string) $this->params)); $this->hostList = $hostList; + $this->view->baseFilter = $this->hostList->getFilter(); $this->getTabs()->add( 'show', array( @@ -152,7 +153,6 @@ class HostsController extends Controller ->toQueryString() ); $this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments'); - $this->view->baseFilter = $this->hostList->getFilter(); $this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/hosts/send-custom-notification'); } diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index deee364fa..26561f8ff 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -33,6 +33,7 @@ class ServicesController extends Controller (string) $this->params->without(array('service_problem', 'service_handled', 'view')) )); $this->serviceList = $serviceList; + $this->view->baseFilter = $this->serviceList->getFilter(); $this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/services'); $this->getTabs()->add( 'show', @@ -163,7 +164,6 @@ class ServicesController extends Controller ); $this->view->commentsLink = Url::fromRequest() ->setPath('monitoring/list/comments'); - $this->view->baseFilter = $this->serviceList->getFilter(); $this->view->sendCustomNotificationLink = Url::fromRequest()->setPath( 'monitoring/services/send-custom-notification' ); From fff9bf7b2b0e58b0bdddec3b36954f9e1c1b7776 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 14:11:56 +0200 Subject: [PATCH 08/17] Implement view to display stats about checks and monitored objects refs #10033 --- ...essController.php => HealthController.php} | 70 ++++++- .../ToggleInstanceFeaturesCommandForm.php | 2 +- .../disable-notifications.phtml | 0 .../views/scripts/health/info.phtml | 84 ++++++++ .../{process => health}/not-running.phtml | 0 .../views/scripts/health/stats.phtml | 106 ++++++++++ .../views/scripts/process/info.phtml | 185 ------------------ modules/monitoring/configuration.php | 2 +- 8 files changed, 256 insertions(+), 193 deletions(-) rename modules/monitoring/application/controllers/{ProcessController.php => HealthController.php} (63%) rename modules/monitoring/application/views/scripts/{process => health}/disable-notifications.phtml (100%) create mode 100644 modules/monitoring/application/views/scripts/health/info.phtml rename modules/monitoring/application/views/scripts/{process => health}/not-running.phtml (100%) create mode 100644 modules/monitoring/application/views/scripts/health/stats.phtml delete mode 100644 modules/monitoring/application/views/scripts/process/info.phtml diff --git a/modules/monitoring/application/controllers/ProcessController.php b/modules/monitoring/application/controllers/HealthController.php similarity index 63% rename from modules/monitoring/application/controllers/ProcessController.php rename to modules/monitoring/application/controllers/HealthController.php index 84a1a15f5..c6f239d0c 100644 --- a/modules/monitoring/application/controllers/ProcessController.php +++ b/modules/monitoring/application/controllers/HealthController.php @@ -11,7 +11,7 @@ use Icinga\Web\Widget\Tabextension\DashboardAction; /** * Display process and performance information of the monitoring host and program-wide commands */ -class ProcessController extends Controller +class HealthController extends Controller { /** * Add tabs @@ -29,10 +29,21 @@ class ProcessController extends Controller 'Show information about the current monitoring instance\'s process' . ' and it\'s performance as well as available features' ), - 'label' => $this->translate('Monitoring Health'), - 'url' =>'monitoring/process/info' + 'label' => $this->translate('Process Information'), + 'url' =>'monitoring/health/info' ) - )->extend(new DashboardAction()); + ) + ->add( + 'stats', + array( + 'title' => $this->translate( + 'Show statistics about the monitored objects' + ), + 'label' => $this->translate('Stats'), + 'url' =>'monitoring/health/stats' + ) + ) + ->extend(new DashboardAction()); } /** @@ -40,7 +51,7 @@ class ProcessController extends Controller */ public function infoAction() { - $this->view->title = $this->translate('Monitoring Health'); + $this->view->title = $this->translate('Process Information'); $this->getTabs()->activate('info'); $this->setAutorefreshInterval(10); $this->view->backendName = $this->backend->getName(); @@ -95,6 +106,53 @@ class ProcessController extends Controller ->getQuery()->fetchAll(); } + /** + * Display stats about current checks and monitored objects + */ + public function statsAction() + { + $this->getTabs()->activate('stats'); + + $servicestats = $this->backend->select()->from('servicestatussummary', array( + 'services_critical', + 'services_critical_handled', + 'services_critical_unhandled', + 'services_ok', + 'services_pending', + 'services_total', + 'services_unknown', + 'services_unknown_handled', + 'services_unknown_unhandled', + 'services_warning', + 'services_warning_handled', + 'services_warning_unhandled' + )); + $this->applyRestriction('monitoring/filter/objects', $servicestats); + $this->view->servicestats = $servicestats->fetchRow(); + + $hoststats = $this->backend->select()->from('hoststatussummary', array( + 'hosts_total', + 'hosts_up', + 'hosts_down', + 'hosts_down_handled', + 'hosts_down_unhandled', + 'hosts_unreachable', + 'hosts_unreachable_handled', + 'hosts_unreachable_unhandled', + 'hosts_pending', + )); + $this->applyRestriction('monitoring/filter/objects', $hoststats); + $this->view->hoststats = $hoststats; + + $this->view->runtimevariables = (object) $this->backend->select() + ->from('runtimevariables', array('varname', 'varvalue')) + ->getQuery()->fetchPairs(); + + $this->view->checkperformance = $this->backend->select() + ->from('runtimesummary') + ->getQuery()->fetchAll(); + } + /** * Disable notifications w/ an optional expire time */ @@ -119,7 +177,7 @@ class ProcessController extends Controller } else { $form = new DisableNotificationsExpireCommandForm(); $form - ->setRedirectUrl('monitoring/process/info') + ->setRedirectUrl('monitoring/health/info') ->handleRequest(); $this->view->form = $form; } diff --git a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php index d487647e2..6f727232f 100644 --- a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php @@ -65,7 +65,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm $notificationDescription = sprintf( '%3$s', $this->translate('Disable notifications for a specific time on a program-wide basis'), - $this->getView()->href('monitoring/process/disable-notifications'), + $this->getView()->href('monitoring/health/disable-notifications'), $this->translate('Disable temporarily') ); } else { diff --git a/modules/monitoring/application/views/scripts/process/disable-notifications.phtml b/modules/monitoring/application/views/scripts/health/disable-notifications.phtml similarity index 100% rename from modules/monitoring/application/views/scripts/process/disable-notifications.phtml rename to modules/monitoring/application/views/scripts/health/disable-notifications.phtml diff --git a/modules/monitoring/application/views/scripts/health/info.phtml b/modules/monitoring/application/views/scripts/health/info.phtml new file mode 100644 index 000000000..78a58d525 --- /dev/null +++ b/modules/monitoring/application/views/scripts/health/info.phtml @@ -0,0 +1,84 @@ +runtimeVariables()->create($this->runtimevariables); +$cp = $this->checkPerformance()->create($this->checkperformance); + +if (! $this->compact): ?> +
+ tabs; ?> +
+ + +
+
+
+

translate('Process Info') ?>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
translate('Program Version') ?>programStatus->program_version + ? $this->programStatus->program_version + : $this->translate('N/A') ?>
translate('Program Start Time') ?>formatDateTime($this->programStatus->program_start_time) ?>
translate('Last Status Update'); ?>timeAgo($this->programStatus->status_update_time); ?>
translate('Last External Command Check'); ?>timeAgo($this->programStatus->last_command_check); ?>
translate('Last Log File Rotation'); ?>programStatus->last_log_rotation + ? $this->timeSince($this->programStatus->last_log_rotation) + : $this->translate('N/A') ?>
translate('Global Service Event Handler'); ?>programStatus->global_service_event_handler + ? $this->programStatus->global_service_event_handler + : $this->translate('N/A'); ?>
translate('Global Host Event Handler'); ?>programStatus->global_host_event_handler + ? $this->programStatus->global_host_event_handler + : $this->translate('N/A'); ?>
translate('Active Endpoint'); ?>programStatus->endpoint_name + ? $this->programStatus->endpoint_name + : $this->translate('N/A') ?>
+ programStatus->is_currently_running === true): ?> +
+ translate( + '%1$s has been up and running with PID %2$d %3$s', + 'Last format parameter represents the time running' + ), + $this->backendName, + $this->programStatus->process_id, + $this->timeSince($this->programStatus->program_start_time)) ?> +
+ +
+ translate('Backend %s is not running'), $this->backendName) ?> +
+ +
+ +
+
+ toggleFeaturesForm; ?> +
+
+
diff --git a/modules/monitoring/application/views/scripts/process/not-running.phtml b/modules/monitoring/application/views/scripts/health/not-running.phtml similarity index 100% rename from modules/monitoring/application/views/scripts/process/not-running.phtml rename to modules/monitoring/application/views/scripts/health/not-running.phtml diff --git a/modules/monitoring/application/views/scripts/health/stats.phtml b/modules/monitoring/application/views/scripts/health/stats.phtml new file mode 100644 index 000000000..30828cec7 --- /dev/null +++ b/modules/monitoring/application/views/scripts/health/stats.phtml @@ -0,0 +1,106 @@ +runtimeVariables()->create($this->runtimevariables); +$cp = $this->checkPerformance()->create($this->checkperformance); + +if (! $this->compact): ?> +
+ tabs ?> +
+ + +
+ +
+ +
+

+ stats = $hoststats ?> + render('list/components/hostssummary.phtml') ?> +

+ + + + + + + + + + + + +
translate('Total') ?> total_scheduled_hosts ?>
translate('Scheduled') ?> total_scheduled_hosts ?>
+ +

+ stats = $servicestats ?> + render('list/components/servicesummary.phtml') ?> +

+ + + + + + + + + + + + + + + + + + + + + + + + +
translate('Amount') ?>translate('Per Host') ?>
translate('Total') ?> total_services ?> average_services_per_host) ?>
translate('Scheduled') ?> total_scheduled_services ?> average_scheduled_services_per_host) ?>
+ +

translate('Active checks') ?>

+ + + + + + + + + + + + + + + + + + + + + + + +
translate('Checks') ?>translate('Latency') ?>translate('Execution time') ?>
translate('Host Checks') ?>host_active_count; ?>host_active_latency_avg) ?>shost_active_execution_avg) ?>s
translate('Service Checks') ?>service_active_count; ?>service_active_latency_avg) ?>sservice_active_execution_avg) ?>s
+ +

translate('Passive checks') ?>

+ + + + + + + + + + + +
translate('Host Checks') ?>host_passive_count ?>
translate('Service Checks') ?>service_passive_count ?>
+
+ +
+
diff --git a/modules/monitoring/application/views/scripts/process/info.phtml b/modules/monitoring/application/views/scripts/process/info.phtml deleted file mode 100644 index 85e576116..000000000 --- a/modules/monitoring/application/views/scripts/process/info.phtml +++ /dev/null @@ -1,185 +0,0 @@ -runtimeVariables()->create($this->runtimevariables); -$cp = $this->checkPerformance()->create($this->checkperformance); - -if (! $this->compact): ?> -
- tabs; ?> -
- - -
-
- -
- toggleFeaturesForm; ?> -
- -
-

translate('Process Info') ?>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
translate('Program Version') ?>programStatus->program_version - ? $this->programStatus->program_version - : $this->translate('N/A') ?>
translate('Program Start Time') ?>formatDateTime($this->programStatus->program_start_time) ?>
translate('Last Status Update'); ?>timeAgo($this->programStatus->status_update_time); ?>
translate('Last External Command Check'); ?>timeAgo($this->programStatus->last_command_check); ?>
translate('Last Log File Rotation'); ?>programStatus->last_log_rotation - ? $this->timeSince($this->programStatus->last_log_rotation) - : $this->translate('N/A') ?>
translate('Global Service Event Handler'); ?>programStatus->global_service_event_handler - ? $this->programStatus->global_service_event_handler - : $this->translate('N/A'); ?>
translate('Global Host Event Handler'); ?>programStatus->global_host_event_handler - ? $this->programStatus->global_host_event_handler - : $this->translate('N/A'); ?>
translate('Active Endpoint'); ?>programStatus->endpoint_name - ? $this->programStatus->endpoint_name - : $this->translate('N/A') ?>
- programStatus->is_currently_running === true): ?> -
- translate( - '%1$s has been up and running with PID %2$d %3$s', - 'Last format parameter represents the time running' - ), - $this->backendName, - $this->programStatus->process_id, - $this->timeSince($this->programStatus->program_start_time)) ?> -
- -
- translate('Backend %s is not running'), $this->backendName) ?> -
- -
- -
-

translate('Performance Info') ?>

- -

translate('Object summaries') ?>

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
translate('overall') ?>translate('scheduled') ?>
- translate('Hosts') ?> - - total_hosts; ?> - - total_scheduled_hosts; ?> -
- translate('Services') ?> - - total_services; ?> - - total_scheduled_services; ?> -
- translate('Average services per host') ?> - - average_services_per_host); ?> - - average_scheduled_services_per_host); ?> -
- -

translate('Active checks') ?>

- - - - - - - - - - - - - - - - - - - - - - - -
translate('Latency') ?>translate('Execution time') ?>
- translate('Host Checks') ?> - host_active_count; ?>host_active_latency_avg); ?>shost_active_execution_avg); ?>s
- translate('Service Checks') ?> - service_active_count; ?>service_active_latency_avg); ?>sservice_active_execution_avg); ?>s
- -

translate('Passive checks') ?>

- - - - - - - - - - - -
- translate('Host Checks') ?> - host_passive_count; ?>
- translate('Service Checks') ?> - service_passive_count; ?>
-
- -
-
diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 4d915c123..49c616a1f 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -222,7 +222,7 @@ $section->add($this->translate('Alert Summary'), array( */ $section = $this->menuSection($this->translate('System')); $section->add($this->translate('Monitoring Health'), array( - 'url' => 'monitoring/process/info', + 'url' => 'monitoring/health/info', 'priority' => 720, 'renderer' => 'Icinga\Module\Monitoring\Web\Menu\BackendAvailabilityMenuItemRenderer' )); From 39c68dd5ce34d4bf5d5cbbcdb426ee8fc4b0523b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 4 Sep 2015 15:01:05 +0200 Subject: [PATCH 09/17] LDAP Auth: Fix Fatal error: Call to a member function hasOid() on a non-object --- library/Icinga/Protocol/Ldap/LdapConnection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Protocol/Ldap/LdapConnection.php b/library/Icinga/Protocol/Ldap/LdapConnection.php index 57b1fe90d..d78b4a147 100644 --- a/library/Icinga/Protocol/Ldap/LdapConnection.php +++ b/library/Icinga/Protocol/Ldap/LdapConnection.php @@ -666,7 +666,7 @@ class LdapConnection implements Selectable, Inspectable $ds = $this->getConnection(); - $serverSorting = $this->capabilities->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID); + $serverSorting = $this->getCapabilities()->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID); if ($serverSorting && $query->hasOrder()) { ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array( array( @@ -761,7 +761,7 @@ class LdapConnection implements Selectable, Inspectable $ds = $this->getConnection(); - $serverSorting = $this->capabilities->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID); + $serverSorting = $this->getCapabilities()->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID); if (! $serverSorting && $query->hasOrder()) { foreach ($query->getOrder() as $rule) { if (! in_array($rule[0], $fields)) { From a630869bcf528468ced70db9c8d3b2095e67fe3a Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 15:17:28 +0200 Subject: [PATCH 10/17] Provide stats for unhandled problems and improve layout refs #10033 --- .../controllers/HealthController.php | 10 ++- .../views/scripts/health/stats.phtml | 64 +++++++++++++++++-- public/css/icinga/widgets.less | 5 ++ 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/modules/monitoring/application/controllers/HealthController.php b/modules/monitoring/application/controllers/HealthController.php index c6f239d0c..bbfdcb030 100644 --- a/modules/monitoring/application/controllers/HealthController.php +++ b/modules/monitoring/application/controllers/HealthController.php @@ -129,6 +129,9 @@ class HealthController extends Controller )); $this->applyRestriction('monitoring/filter/objects', $servicestats); $this->view->servicestats = $servicestats->fetchRow(); + $this->view->unhandledServiceProblems = $this->view->servicestats->services_critical_unhandled + + $this->view->servicestats->services_unknown_unhandled + + $this->view->servicestats->services_warning_unhandled; $hoststats = $this->backend->select()->from('hoststatussummary', array( 'hosts_total', @@ -142,7 +145,12 @@ class HealthController extends Controller 'hosts_pending', )); $this->applyRestriction('monitoring/filter/objects', $hoststats); - $this->view->hoststats = $hoststats; + $this->view->hoststats = $hoststats->fetchRow(); + $this->view->unhandledhostProblems = $this->view->hoststats->hosts_down_unhandled + + $this->view->hoststats->hosts_unreachable_unhandled; + + $this->view->unhandledProblems = $this->view->unhandledhostProblems + + $this->view->unhandledServiceProblems; $this->view->runtimevariables = (object) $this->backend->select() ->from('runtimevariables', array('varname', 'varvalue')) diff --git a/modules/monitoring/application/views/scripts/health/stats.phtml b/modules/monitoring/application/views/scripts/health/stats.phtml index 30828cec7..275fbf4f8 100644 --- a/modules/monitoring/application/views/scripts/health/stats.phtml +++ b/modules/monitoring/application/views/scripts/health/stats.phtml @@ -9,16 +9,56 @@ if (! $this->compact): ?>
-
-
+

unhandledProblems ?> translate('Unhandled Problems:') ?> + unhandledProblems ?> +

+ + + + + + + + + + + +
translate('Service Problems:') ?> + + qlink( + $this->unhandledServiceProblems, + 'monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity' + ) + ?> + +
translate('Host Problems:') ?> + + qlink( + $this->unhandledhostProblems, + 'monitoring/list/hosts?host_problem=1&host_handled=0' + ) + ?> + +
+
+

stats = $hoststats ?> render('list/components/hostssummary.phtml') ?>

- + + + + + + + + @@ -30,17 +70,17 @@ if (! $this->compact): ?>
translate('Runtime Variables') ?>translate('Host Checks') ?>
translate('Total') ?>
+

stats = $servicestats ?> render('list/components/servicesummary.phtml') ?>

- - - + + @@ -60,12 +100,13 @@ if (! $this->compact): ?>
translate('Amount') ?> translate('Runtime Variables') ?> translate('Service Checks') ?> translate('Per Host') ?>
+

translate('Active checks') ?>

- + @@ -86,9 +127,18 @@ if (! $this->compact): ?>
translate('Check Performance') ?> translate('Checks') ?> translate('Latency') ?> translate('Execution time') ?>
+

translate('Passive checks') ?>

+ + + + + + + + diff --git a/public/css/icinga/widgets.less b/public/css/icinga/widgets.less index 95b64429a..9f884e746 100644 --- a/public/css/icinga/widgets.less +++ b/public/css/icinga/widgets.less @@ -234,6 +234,11 @@ li li .badge-container { background-color: @colorInvalid; } +.badge a[href] { + color: white; + text-decoration: none; +} + #menu nav ul .badge { margin-right: 0em; top: 0.3em; From 8837004fca1c462b18cced63b378dd7b84bd3558 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 15:24:26 +0200 Subject: [PATCH 11/17] Fix base target in problem badges The stats view is always a main pane, so it makes sense to open the badge links in col2. refs #10033 --- .../application/views/scripts/health/stats.phtml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/health/stats.phtml b/modules/monitoring/application/views/scripts/health/stats.phtml index 275fbf4f8..792b5a050 100644 --- a/modules/monitoring/application/views/scripts/health/stats.phtml +++ b/modules/monitoring/application/views/scripts/health/stats.phtml @@ -23,7 +23,9 @@ if (! $this->compact): ?> qlink( $this->unhandledServiceProblems, - 'monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity' + 'monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity', + null, + array('data-base-target' => '_next') ) ?> @@ -36,7 +38,9 @@ if (! $this->compact): ?> qlink( $this->unhandledhostProblems, - 'monitoring/list/hosts?host_problem=1&host_handled=0' + 'monitoring/list/hosts?host_problem=1&host_handled=0', + null, + array('data-base-target' => '_next') ) ?> From 354bd0dd788942fd46d53593e20bd4a94a04402d Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 15:35:50 +0200 Subject: [PATCH 12/17] Fix badge link color in avp tables --- modules/monitoring/public/css/module.less | 4 ++++ public/css/icinga/widgets.less | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index a239862c3..e27817613 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -180,6 +180,10 @@ table.avp { color: @colorMainForeground; } + .badge a[href] { + color: @colorGray; + } + .go-ahead { a, button.link-like { color: #222; diff --git a/public/css/icinga/widgets.less b/public/css/icinga/widgets.less index 9f884e746..c0d9d7b89 100644 --- a/public/css/icinga/widgets.less +++ b/public/css/icinga/widgets.less @@ -235,7 +235,7 @@ li li .badge-container { } .badge a[href] { - color: white; + color: @colorGray; text-decoration: none; } From 0738a37fdf88320c41a7078df49463231b9d61df Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 16:35:41 +0200 Subject: [PATCH 13/17] Display sticky comments in "Muted" tab refs #6144 --- modules/monitoring/configuration.php | 38 ++++++++++++++----- .../Monitoring/DataView/Hoststatus.php | 3 +- .../Monitoring/DataView/Servicestatus.php | 3 +- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 755538625..6456686e9 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -265,22 +265,18 @@ $dashboard->add( */ $dashboard = $this->dashboard($this->translate('Overdue')); $dashboard->add( - $this->translate('Acks Older Than Three Days'), - 'monitoring/list/comments?comment_type=Ack&comment_timestamp<-3 days' + $this->translate('Acknowledgements Active For At Least Three Days'), + 'monitoring/list/comments?comment_type=Ack&comment_timestamp<-3 days&sort=comment_timestamp&dir=asc' ); $dashboard->add( - $this->translate('Downtimes Older Than Three Days'), + $this->translate('Downtimes Active For More Than Three Days'), 'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc' ); -$dashboard->add( - $this->translate('Oldest Sticky Comments'), - 'monitoring/list/comments?comment_type=Ack&TODO' -); /* * Muted Objects */ -$dashboard = $this->dashboard($this->translate('Muted Objects')); +$dashboard = $this->dashboard($this->translate('Muted')); $dashboard->add( $this->translate('Disabled Service Notifications'), 'monitoring/list/services?service_notifications_enabled=0&limit=10' @@ -297,6 +293,14 @@ $dashboard->add( $this->translate('Disabled Host Checks'), 'monitoring/list/hosts?host_active_checks_enabled=0&limit=10' ); +$dashboard->add( + $this->translate('Acknowledged Problem Services'), + 'monitoring/list/services?service_acknowledgement_type=2&service_problem=1&sort=service_state&limit=10' +); +$dashboard->add( + $this->translate('Acknowledged Problem Hosts'), + 'monitoring/list/hosts?host_acknowledgement_type=2&host_problem=1&sort=host_severity&limit=10' +); /* * Activity Stream @@ -323,9 +327,25 @@ $dashboard->add( 'monitoring/list/eventhistory?type=dt_end&sort=timestamp&dir=desc&limit=8' ); +/* + * Stats + */ +$dashboard = $this->dashboard($this->translate('Stats')); +$dashboard->add( + $this->translate('Weekly Alert Summary'), + 'monitoring/alertsummary/index?limit=5&interval=1w' +); +$dashboard->add( + $this->translate('Check Stats'), + 'monitoring/health/stats' +); +$dashboard->add( + $this->translate('Process Information'), + 'monitoring/health/info' +); + /* * CSS */ $this->provideCssFile('colors.less'); $this->provideCssFile('service-grid.less'); - diff --git a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php index 05385763c..413f175f1 100644 --- a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php @@ -58,7 +58,8 @@ class HostStatus extends DataView 'host_modified_host_attributes', 'host_severity', 'host_problem', - 'host_ipv4' + 'host_ipv4', + 'host_acknowledgement_type' ); } diff --git a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php index ff68474f1..f12c66535 100644 --- a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php @@ -92,7 +92,8 @@ class ServiceStatus extends DataView 'service_flap_detection_enabled', 'service_flap_detection_enabled_changed', 'service_modified_service_attributes', - 'service_host_name' + 'service_host_name', + 'service_acknowledgement_type' ); } From 78d679b597a30bed3091b0df39e8a2fb9f3de4dc Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 17:09:24 +0200 Subject: [PATCH 14/17] Fix typos and limit activity stream to 3 days refs #6144 --- modules/monitoring/configuration.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 6456686e9..d17a3b012 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -307,24 +307,24 @@ $dashboard->add( */ $dashboard = $this->dashboard($this->translate('Activity Stream')); $dashboard->add( - $this->translate('Todays Events'), - 'monitoring/list/eventhistory?timestamp>=-1%20days&sort=timestamp&dir=desc&limit=8' + $this->translate('Recent Events'), + 'monitoring/list/eventhistory?timestamp>=-3%20days&sort=timestamp&dir=desc&limit=8' ); $dashboard->add( - $this->translate('Hard State Changed'), - 'monitoring/list/eventhistory?type=hard_state&sort=timestamp&dir=desc&limit=8' + $this->translate('Recent Hard State Changes'), + 'monitoring/list/eventhistory?timestamp>=-3%20days&type=hard_state&sort=timestamp&dir=desc&limit=8' ); $dashboard->add( - $this->translate('Notifications'), - 'monitoring/list/eventhistory?type=notify&sort=timestamp&dir=desc&limit=8' + $this->translate('Recent Notifications'), + 'monitoring/list/eventhistory?timestamp>=-3%20days&type=notify&sort=timestamp&dir=desc&limit=8' ); $dashboard->add( - $this->translate('Downtimes Started'), - 'monitoring/list/eventhistory?type=dt_start&sort=timestamp&dir=desc&limit=8' + $this->translate('Recent Downtimes Started'), + 'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_start&sort=timestamp&dir=desc&limit=8' ); $dashboard->add( - $this->translate('Downtimes Ended'), - 'monitoring/list/eventhistory?type=dt_end&sort=timestamp&dir=desc&limit=8' + $this->translate('Recent Downtimes Ended'), + 'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_end&sort=timestamp&dir=desc&limit=8' ); /* From 14565dad34aca87b3ec61fa6457c25881af61861 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 17:10:18 +0200 Subject: [PATCH 15/17] Remove obsolete alert summary from stats refs #6144 --- modules/monitoring/configuration.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index d17a3b012..fb4d0ea79 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -331,10 +331,6 @@ $dashboard->add( * Stats */ $dashboard = $this->dashboard($this->translate('Stats')); -$dashboard->add( - $this->translate('Weekly Alert Summary'), - 'monitoring/alertsummary/index?limit=5&interval=1w' -); $dashboard->add( $this->translate('Check Stats'), 'monitoring/health/stats' From f73e6d9225b60a9fc4b9dc512644ce530b280e91 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 4 Sep 2015 17:17:51 +0200 Subject: [PATCH 16/17] Fix typo in activity stream dashlet names refs #6144 --- modules/monitoring/configuration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index fb4d0ea79..2d61274ec 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -319,11 +319,11 @@ $dashboard->add( 'monitoring/list/eventhistory?timestamp>=-3%20days&type=notify&sort=timestamp&dir=desc&limit=8' ); $dashboard->add( - $this->translate('Recent Downtimes Started'), + $this->translate('Downtimes Recently Started'), 'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_start&sort=timestamp&dir=desc&limit=8' ); $dashboard->add( - $this->translate('Recent Downtimes Ended'), + $this->translate('Downtimes Recently Ended'), 'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_end&sort=timestamp&dir=desc&limit=8' ); From c9c57623201e1c971b5d626b75a7f1eeb84c64f3 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 4 Sep 2015 18:10:28 +0200 Subject: [PATCH 17/17] monitoring/detail: Don't fail if a macro does not exist on the host or service --- modules/monitoring/library/Monitoring/Object/Macro.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Object/Macro.php b/modules/monitoring/library/Monitoring/Object/Macro.php index 4a9045b58..0a6f3a8c0 100644 --- a/modules/monitoring/library/Monitoring/Object/Macro.php +++ b/modules/monitoring/library/Monitoring/Object/Macro.php @@ -55,10 +55,10 @@ class Macro */ public static function resolveMacro($macro, $object) { - if (array_key_exists($macro, self::$icingaMacros) && $object->{self::$icingaMacros[$macro]} !== false) { + if (isset(self::$icingaMacros[$macro]) && isset($object->{self::$icingaMacros[$macro]})) { return $object->{self::$icingaMacros[$macro]}; } - if (array_key_exists($macro, $object->customvars)) { + if (isset($object->customvars[$macro])) { return $object->customvars[$macro]; }
translate('Check Performance') ?> translate('Passive Checks') ?>
translate('Host Checks') ?>