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

make PHP 8.2 compatible #325

Open ggzengel opened 1 year ago

ggzengel commented 1 year ago

If I access /icingaweb2/icingadb/host?name=hosti I get:

Deprecated: Creation of dynamic property Icinga\Module\Grafana\ProvidedHook\Icingadb\HostDetailExtension::$permission is deprecated in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php on line 75

Deprecated: Creation of dynamic property Icinga\Module\Grafana\ProvidedHook\Icingadb\HostDetailExtension::$dashboard is deprecated in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php on line 222

Deprecated: Creation of dynamic property Icinga\Module\Grafana\ProvidedHook\Icingadb\HostDetailExtension::$dashboarduid is deprecated in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php on line 223

Deprecated: Creation of dynamic property Icinga\Module\Grafana\ProvidedHook\Icingadb\HostDetailExtension::$panelId is deprecated in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php on line 228

Deprecated: Creation of dynamic property Icinga\Module\Grafana\ProvidedHook\Icingadb\HostDetailExtension::$orgId is deprecated in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php on line 229

Deprecated: Creation of dynamic property Icinga\Module\Grafana\ProvidedHook\Icingadb\HostDetailExtension::$customVars is deprecated in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php on line 230

Deprecated: Creation of dynamic property Icinga\Module\Grafana\ProvidedHook\Icingadb\HostDetailExtension::$pngUrl is deprecated in /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php on line 275
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:    12
Codename:   bookworm

# head -n 2 /etc/icingaweb2/enabledModules/*/module.info
==> /etc/icingaweb2/enabledModules/grafana/module.info <==
Name: Grafana
Version: 2.0.3
==> /etc/icingaweb2/enabledModules/icingadb/module.info <==
Module: icingadb
Version: 1.0.2

# dpkg-query -l *icinga* *php* | grep ^ii
ii  icinga-php-library           0.13.0-1+debian12                       all          Icinga PHP Library - IPL
ii  icinga-php-thirdparty        0.12.0-1+debian12                       all          Icinga 3rd party PHP libraries
ii  icingacli                    2.11.4-2                                all          simple CLI tool for Icingaweb2 and its modules
ii  icingadb-web                 1.0.2-1                                 all          Icinga DB Web for Icinga Web 2
ii  icingaweb2                   2.11.4-2                                all          simple and responsive web interface for Icinga
ii  icingaweb2-common            2.11.4-2                                all          simple and responsive web interface for Icinga - common files
ii  icingaweb2-module-doc        2.11.4-2                                all          simple and responsive web interface for Icinga - documentation module
ii  icingaweb2-module-monitoring 2.11.4-2                                all          simple and responsive web interface for Icinga - monitoring module
ii  libapache2-mod-php8.2        8.2.7-1~deb12u1                         amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php                          2:8.2+93                                all          server-side, HTML-embedded scripting language (default)
ii  php-common                   2:93                                    all          Common files for PHP packages
ii  php-curl                     2:8.2+93                                all          CURL module for PHP [default]
ii  php-gd                       2:8.2+93                                all          GD module for PHP [default]
ii  php-icinga                   2.11.4-2                                all          PHP library to communicate with and use Icinga
ii  php-imagick                  3.7.0-4                                 amd64        Provides a wrapper to the ImageMagick library
ii  php-intl                     2:8.2+93                                all          Internationalisation module for PHP [default]
ii  php-json                     2:8.2+93                                all          JSON module for PHP [default]
ii  php-ldap                     2:8.2+93                                all          LDAP module for PHP [default]
ii  php-mbstring                 2:8.2+93                                all          MBSTRING module for PHP [default]
ii  php-mysql                    2:8.2+93                                all          MySQL module for PHP [default]
ii  php-pear                     1:1.10.13+submodules+notgz+2022032202-2 all          PEAR Base System
ii  php-pgsql                    2:8.2+93                                all          PostgreSQL module for PHP [default]
ii  php-php-gettext              1.0.12-5                                all          read gettext MO files directly, without requiring anything other than PHP
ii  php-soap                     2:8.2+93                                all          SOAP module for PHP [default]
ii  php-xml                      2:8.2+93                                all          DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default]
ii  php8.2                       8.2.7-1~deb12u1                         all          server-side, HTML-embedded scripting language (metapackage)
ii  php8.2-cli                   8.2.7-1~deb12u1                         amd64        command-line interpreter for the PHP scripting language
ii  php8.2-common                8.2.7-1~deb12u1                         amd64        documentation, examples and common module for PHP
ii  php8.2-curl                  8.2.7-1~deb12u1                         amd64        CURL module for PHP
ii  php8.2-gd                    8.2.7-1~deb12u1                         amd64        GD module for PHP
ii  php8.2-imagick               3.7.0-4                                 amd64        Provides a wrapper to the ImageMagick library
ii  php8.2-intl                  8.2.7-1~deb12u1                         amd64        Internationalisation module for PHP
ii  php8.2-ldap                  8.2.7-1~deb12u1                         amd64        LDAP module for PHP
ii  php8.2-mbstring              8.2.7-1~deb12u1                         amd64        MBSTRING module for PHP
ii  php8.2-mysql                 8.2.7-1~deb12u1                         amd64        MySQL module for PHP
ii  php8.2-opcache               8.2.7-1~deb12u1                         amd64        Zend OpCache module for PHP
ii  php8.2-pgsql                 8.2.7-1~deb12u1                         amd64        PostgreSQL module for PHP
ii  php8.2-phpdbg                8.2.7-1~deb12u1                         amd64        server-side, HTML-embedded scripting language (PHPDBG binary)
ii  php8.2-readline              8.2.7-1~deb12u1                         amd64        readline module for PHP
ii  php8.2-soap                  8.2.7-1~deb12u1                         amd64        SOAP module for PHP
ii  php8.2-xml                   8.2.7-1~deb12u1                         amd64        DOM, SimpleXML, XML, and XSL module for PHP
ggzengel commented 1 year ago
Name    grafana
State   enabled
Version     2.0.3
Git commit  b9d2b6a13b0b6b06f267bf0b2750fd51d9cb60ce 
Mikesch-mp commented 1 year ago

Icingaweb 2.11 is not fully PHP 8.2 compatible. i will only test with php 8.2 and icingaweb 2.12 when i have my developer machines delivered

mafri27 commented 1 year ago

@ggzengel you can fix it temporary in the same way it is done in application/controllers/IcingadbimgController.php with

diff --git a/library/Grafana/ProvidedHook/Icingadb/HostDetailExtension.php b/library/Grafana/ProvidedHook/Icingadb/HostDetailExtension.php
index 85a0126..dc0ec75 100644
--- a/library/Grafana/ProvidedHook/Icingadb/HostDetailExtension.php
+++ b/library/Grafana/ProvidedHook/Icingadb/HostDetailExtension.php
@@ -8,6 +8,7 @@ use ipl\Html\Html;
 use ipl\Html\HtmlString;
 use ipl\Html\ValidHtml;

+#[\AllowDynamicProperties]
 class HostDetailExtension extends HostDetailExtensionHook
 {
     use IcingaDbGrapher;
diff --git a/library/Grafana/ProvidedHook/Icingadb/ServiceDetailExtension.php b/library/Grafana/ProvidedHook/Icingadb/ServiceDetailExtension.php
index 00fa6ed..0d4fa9c 100644
--- a/library/Grafana/ProvidedHook/Icingadb/ServiceDetailExtension.php
+++ b/library/Grafana/ProvidedHook/Icingadb/ServiceDetailExtension.php
@@ -8,6 +8,7 @@ use ipl\Html\Html;
 use ipl\Html\HtmlString;
 use ipl\Html\ValidHtml;

+#[\AllowDynamicProperties]
 class ServiceDetailExtension extends ServiceDetailExtensionHook
 {
     use IcingaDbGrapher;
ggzengel commented 1 year ago

@ggzengel you can fix it temporary in the same way it is done in application/controllers/IcingadbimgController.php ...

Thanks it works

Aleksey-Maksimov commented 6 months ago

Hello.

It looks like there is a similar problem in the IcingadbshowController:

Deprecated
: Creation of dynamic property Icinga\Module\Grafana\Controllers\IcingadbshowController::$object is deprecated in
/usr/share/icingaweb2/modules/grafana/application/controllers/IcingadbshowController.php
on line
86