diff --git a/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/BackendAvailabilityNavigationItemRenderer.php b/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/BackendAvailabilityNavigationItemRenderer.php index 2e1d2ccd4..b5bfad5b4 100644 --- a/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/BackendAvailabilityNavigationItemRenderer.php +++ b/modules/monitoring/library/Monitoring/Web/Navigation/Renderer/BackendAvailabilityNavigationItemRenderer.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Monitoring\Web\Navigation\Renderer; use Exception; +use Icinga\Application\Logger; use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Web\Navigation\Renderer\BadgeNavigationItemRenderer; @@ -40,37 +41,33 @@ class BackendAvailabilityNavigationItemRenderer extends BadgeNavigationItemRende { if ($this->count === null) { try { - $count = 0; $programStatus = $this->isCurrentlyRunning(); - $titles = array(); - if (! (bool) $programStatus->notifications_enabled) { - $count = 1; - $this->state = static::STATE_WARNING; - $titles[] = mt('monitoring', 'Notifications are disabled'); - } - if (! (bool) $programStatus->is_currently_running) { - $count = 1; - $this->state = static::STATE_CRITICAL; - array_unshift($titles, sprintf( - mt('monitoring', 'Monitoring backend %s is not running'), - MonitoringBackend::instance()->getName() - )); - } - $this->count = $count; - $this->title = implode('. ', $titles); - } catch (Exception $_) { + } 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(); + if (! (bool) $programStatus->notifications_enabled) { + $count = 1; + $this->state = static::STATE_WARNING; + $titles[] = mt('monitoring', 'Notifications are disabled'); + } + if (! (bool) $programStatus->is_currently_running) { + $count = 1; + $this->state = static::STATE_CRITICAL; + array_unshift($titles, sprintf( + mt('monitoring', 'Monitoring backend %s is not running'), + MonitoringBackend::instance()->getName() + )); + } + $this->count = $count; + $this->title = implode('. ', $titles); } return $this->count; } - - /** - * {@inheritdoc} - */ - public function getState() - { - return $this->state; - } }