Mikesch-mp / icingaweb2-module-grafana

Grafana module for Icinga Web 2 (supports InfluxDB & Graphite)
https://icinga.com/community/
GNU General Public License v2.0
241 stars 95 forks source link

Version clash between icingadb-web and icingaweb2-module-grafana causes stacktrace #327

Closed jwilliams-shadowsoft closed 1 year ago

jwilliams-shadowsoft commented 1 year ago

Description

Version clash between icingadb-web and icingaweb2-module-grafana causes stacktrace

Abstract

A clash between very specific versions of icingadb-web and icingaweb2-module-grafana causes a stacktrace within the grafana module and for no embedded graphs to be displayed.

Scenario

Versions

Package Version
icinga2 v2.13.7
icingaweb2 v2.12.0
icingadb v1.1.1
icingadb-web v1.1.0 (broken)
v1.0.2 (works)
icinga-module-grafana v1.4.2

Steps to reproduce

  1. Install system with all versions above, including icingadb-web v1.1.0.
  2. Navigate to any icingadb-web page showing a Host or Service where a Grafana graph would normally appear.
  3. Instead of the graph appearing, the following error is shown in bold:

    ErrorException in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Grapher.php:298 with message: Object of class DateTime could not be converted to int

Workaround

  1. Downgrade the icingadb-web to v1.0.2.
  2. Refresh the browser and the graph appears.

Full stacktrace

Oct 27 12:56:31 othrpeq0003 icingaweb[511076]: Failed to load legacy grapher: ErrorException in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Grapher.php:298 
with message: Object of class DateTime could not be converted to int
    #0 /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Grapher.php(298): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(8, 'Object of class...', '/usr/share/icin...', 298, Array)
    #1 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/Detail/ObjectDetail.php(468): Icinga\Module\Grafana\ProvidedHook\Grapher->getPreviewHtml(Object(Icinga\Module\Icingadb\Compat\CompatService))
    #2 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/Detail/ServiceDetail.php(35): Icinga\Module\Icingadb\Widget\Detail\ObjectDetail->createExtensions()
    #3 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(344): Icinga\Module\Icingadb\Widget\Detail\ServiceDetail->assemble()
    #4 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(566): ipl\Html\HtmlDocument->ensureAssembled()
    #5 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
    #6 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(297): ipl\Html\HtmlDocument->renderUnwrapped()
    #7 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(365): ipl\Html\BaseHtmlElement->renderContent()
    #8 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\BaseHtmlElement->renderUnwrapped()
    #9 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
    #10 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\HtmlDocument->renderUnwrapped()
    #11 /usr/share/icinga-php/ipl/vendor/ipl/web/src/Compat/ViewRenderer.php(56): ipl\Html\HtmlDocument->render()
    #12 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(970): ipl\Web\Compat\ViewRenderer->render()
    #13 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
    #14 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Web/Controller.php(480): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
    #15 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Icinga\Module\Icingadb\Web\Controller->dispatch('indexAction')
    #16 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(954): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
    #17 /usr/share/php/Icinga/Application/Web.php(294): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
    #18 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()
    #19 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')
    #20 {main}

Other environmental context

Additional context

This bug is being cross-posted on:

Mikesch-mp commented 1 year ago
icinga-module-grafana | v1.4.2 -- | --

This version is not made for icingadb. Update it to v2 and your good to go