From 439d78a982eb2beef8bd3ec16478ec284f4849ae Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 27 Jul 2017 11:31:10 +0200 Subject: [PATCH] Don't hide errors in the MonitoringBadgeNavigationItemRenderer If an exception occurs when fetching the dataview, we will now log the exception and display a badge in state unknown. --- .../Renderer/MonitoringBadgeNavigationItemRenderer.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/MonitoringBadgeNavigationItemRenderer.php b/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/MonitoringBadgeNavigationItemRenderer.php index 683893b22..e06526e80 100644 --- a/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/MonitoringBadgeNavigationItemRenderer.php +++ b/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/MonitoringBadgeNavigationItemRenderer.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Monitoring\Web\Navigation\Renderer; use Exception; +use Icinga\Application\Logger; use Icinga\Authentication\Auth; use Icinga\Data\Filter\Filter; use Icinga\Data\Filterable; @@ -142,8 +143,12 @@ class MonitoringBadgeNavigationItemRenderer extends BadgeNavigationItemRenderer if ($this->count === null) { try { $summary = $this->fetchDataView(); - } catch (Exception $_) { - $this->count = 0; + } catch (Exception $e) { + Logger::debug($e); + $this->count = 1; + $this->state = static::STATE_UNKNOWN; + $this->title = $e->getMessage(); + return $this->count; } $count = 0; $titles = array();