icingaweb2-module-grafana
icingaweb2-module-grafana copied to clipboard
grafana module | make PHP 8.2 compatible
hello, when im enable graphana modole i have bellow errors in: /icingaweb2/dashboard#!/icingaweb2/icingadb/host?name=
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/businessprocess/module.info <==
Name: Businessprocess
Version: 2.5.0
==> /etc/icingaweb2/enabledModules/director/module.info <==
Name: Icinga Director
Version: 1.11.0
==> /etc/icingaweb2/enabledModules/doc/module.info <==
Module: doc
Version: 2.12.1
==> /etc/icingaweb2/enabledModules/elasticsearch/module.info <==
Module: elasticsearch
Version: 1.0.0
==> /etc/icingaweb2/enabledModules/fileshipper/module.info <==
Name: Fileshipper
Version: 1.2.0
==> /etc/icingaweb2/enabledModules/grafana/module.info <==
Name: Grafana
Version: 2.0.3
==> /etc/icingaweb2/enabledModules/icingadb/module.info <==
Module: icingadb
Version: 1.1.1
==> /etc/icingaweb2/enabledModules/incubator/module.info <==
Name: Incubator
Version: 0.20.0
==> /etc/icingaweb2/enabledModules/migrate/module.info <==
Module: migrate
Version: 2.12.1
icingacli module list
MODULE VERSION STATE DESCRIPTION
director 1.11.0 enabled Director - Config tool for Icinga 2
doc 2.12.1 enabled Documentation module
incubator 0.20.0 enabled Incubator provides bleeding-edge libraries
migrate 2.12.1 enabled Migrate module
monitoring 2.12.1 enabled Icinga monitoring module
dpkg-query -l icinga php | grep ^ii
ii icinga-director 1.11.0-1+debian12 all Configuration automation and deployment tool in the Icinga ecosystem
ii icinga-director-daemon 1.11.0-1+debian12 all Icinga Director Daemon files
ii icinga-director-php 1.11.0-1+debian12 all Icinga Director PHP files
ii icinga-director-web 1.11.0-1+debian12 all Icinga Director Web files
ii icinga-l10n 1.3.0-1+debian12 all Icinga localization
ii icinga-php-incubator 0.20.0-1+debian12 all Icinga PHP Incubator Libraries
ii icinga-php-library 0.13.1-1+debian12 all Icinga PHP Library - IPL
ii icinga-php-thirdparty 0.12.1-1+debian12 all Icinga 3rd party PHP libraries
ii icinga2 2.14.2-1+debian12 amd64 host and network monitoring system
ii icinga2-bin 2.14.2-1+debian12 amd64 host and network monitoring system - daemon
ii icinga2-common 2.14.2-1+debian12 all host and network monitoring system - common files
ii icinga2-doc 2.14.2-1+debian12 all host and network monitoring system - documentation
ii icingacli 2.12.1-1+debian12 all Icinga CLI
ii icingadb 1.1.1-1+debian12 amd64 Icinga configuration and state database supporting multiple environments
ii icingadb-redis 7.0.12-1+debian12 all Persistent key-value database with network interface (metapackage)
ii icingadb-redis-server 7.0.12-1+debian12 amd64 Persistent key-value database with network interface
ii icingadb-redis-tools 7.0.12-1+debian12 amd64 Persistent key-value database with network interface (client)
ii icingadb-web 1.1.1-1+debian12 all Icinga DB Web
ii icingaweb2 2.12.1-1+debian12 all Icinga Web
ii icingaweb2-common 2.12.1-1+debian12 all Common files for Icinga Web and the Icinga CLI
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.12.1-1+debian12 all Icinga Web PHP library
ii php-intl 2:8.2+93 all Internationalisation 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-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-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
Hello,
can you also do this for php 8.3?
regards, Geert
I have solved it in 1.4.2 but I guess it's the same solution in the latest version as well. It's a pretty simple one. Here are the patches I'm using on my master servers.
I guess the first one is already solved in later versions of the grafana module. But for 1.4.2 it is needed.
--- /usr/share/icingaweb2/modules/grafana/library/Grafana/Helpers/Timeranges.php.orig 2024-02-01 17:09:46.976830967 +0000
+++ /usr/share/icingaweb2/modules/grafana/library/Grafana/Helpers/Timeranges.php 2024-02-01 17:10:54.218580572 +0000
@@ -92,7 +92,7 @@
private function buildTimerangeMenu($timerange = "", $timerangeto = "")
{
$clockIcon = $this->view->qlink('', 'dashboard/new-dashlet',
- ['url' => 'grafana/dashboard?' . http_build_query($this->urlparams, null, '&', PHP_QUERY_RFC3986)],
+ ['url' => 'grafana/dashboard?' . http_build_query($this->urlparams, '', '&', PHP_QUERY_RFC3986)],
['icon' => 'clock', 'title' => 'Add graph to dashboard']);
$menu = '<table class="grafana-table"><tr>';
--- /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Grapher.php.orig 2024-02-01 17:06:22.991519674 +0000
+++ /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Grapher.php 2024-02-01 17:08:03.964150996 +0000
@@ -55,6 +55,13 @@
protected $cacheTime = 300;
protected $grafanaVersion = "0";
protected $defaultdashboarduid;
+ protected $permission;
+ protected $object;
+ protected $dashboard;
+ protected $dashboarduid;
+ protected $panelId;
+ protected $orgId;
+ protected $customVars;
protected function init()
{
Hello,
based on what @mvahani gave as information, I only added these lines in the file IcingaDbGrapher.php
diff --git a/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php b/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php
--- a/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php
+++ b/library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php
@@ -68,6 +68,12 @@ trait IcingaDbGrapher
protected $grafanaVersion = "0";
protected $defaultdashboarduid;
protected $object;
+ protected $permission;
+ protected $dashboard;
+ protected $dashboarduid;
+ protected $panelId;
+ protected $orgId;
+ protected $customVars;
Now I have no more errors in icingadb-web in combination with php 8.3
I also add these 2 cases for the iframe provided by @dnsmichi as a pull request: https://github.com/Mikesch-mp/icingaweb2-module-grafana/pull/318 https://github.com/Mikesch-mp/icingaweb2-module-grafana/pull/328
As a result, I now have the link "see in grafana" above the graph
See here all the modification I made iframe_and_php83.txt
Thank you. This worked for me