Icinga / icingaweb2-module-graphite

The Graphite module for displays data stored in Graphite directly in the Icinga Web 2 interface.
https://icinga.com/docs/graphite/latest
GNU General Public License v2.0
73 stars 32 forks source link

Broken graphs with php 8.2 #301

Closed BastienDurel closed 1 year ago

BastienDurel commented 1 year ago

After upgrading to PHP 8.2 (debian 12 default), graphs are broken (invalid data)

Each image generated has text prepended :

Deprecated:  Creation of dynamic property Icinga\Module\Graphite\Controllers\MonitoringGraphController::$backend is deprecated in /usr/share/icingaweb2/modules/graphite/library/Graphite/Web/Controller/MonitoringAwareController.php on line 47

Declaring the $backen property resolves the warning, and therefore corrects the images.

diff --git a/library/Graphite/Web/Controller/MonitoringAwareController.php b/library/Graphite/Web/Controller/MonitoringAwareController.php
index dca2ebd..59caa80 100644
--- a/library/Graphite/Web/Controller/MonitoringAwareController.php
+++ b/library/Graphite/Web/Controller/MonitoringAwareController.php
@@ -21,6 +21,7 @@ abstract class MonitoringAwareController extends Controller
 {
     /** @var bool Whether to use icingadb as the backend */
     protected $useIcingadbAsBackend = false;
+    protected $backend = null;

     /**
      * Restrict the given monitored object query for the currently authenticated user

Your Environment

nilmerg commented 1 year ago

Will be fixed in the upcoming release.

abma commented 1 year ago

I've hit the same problem, this commit fixed it for me:

https://github.com/Icinga/icingaweb2-module-graphite/commit/c7abdfa0f340efe15aa2e4bcb5c2e5c084053c18

more specific the change in library/Graphite/Web/Controller/MonitoringAwareController.php:

https://github.com/Icinga/icingaweb2-module-graphite/commit/c7abdfa0f340efe15aa2e4bcb5c2e5c084053c18#diff-2e23f74bc88b6a8f91b8c06df8c63a96d0a4f790172ef09e4989eb6d997ea65f