WeatherMap editor and php 8.1 : incompatibility?

Hello everybody,

As recommended by the VALIDATE of LIBRENMS, I updated my version of PHP to 8.1.
Since php 8.1 update (7.3 to 8.1), my weathermap editor doesn’t work. Have you also encountered this problem ?
I have errors like this in several php function :
“Unsupported operand types: string / int”

Has anyone found a solution ?

Best regards,
Olivier

2 Likes

There seems to be active talk and testing relating to this here which will hopefully find an answer soon: https://github.com/librenms-plugins/Weathermap/issues/78

At the end of that is a fork with changes that might fix it that they are requesting people to test before they submit a pull request: https://github.com/LoveSkylark/LibreNMS-Weathermap

im having the exact same problem
dont know what to do with this ?

bash-4.2$ php check.php
PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /opt/librenms/html/plugins/Weathermap/Weathermap/check.php on line 261
bash-4.2$

bash-4.2$ ./validate.php

Component Version
LibreNMS 22.8.0-57-g302a989
DB Schema 2022_07_03_1947_add_app_data (244)
PHP 8.1.10
Python 3.6.8
Database MariaDB 10.5.17-MariaDB
RRDTool 1.4.8
SNMP 5.7.2

====================================

[OK] Composer Version: 2.4.1
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK]
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrdtool version ok
[OK] Connected to rrdcached

cd plugins/Weathermap
git pull

bash-4.2$ php check.php
PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /opt/librenms/html/plugins/Weathermap/check.php on line 261
bash-4.2$ git pull
Already up-to-date.

1 Like

I have the same issue after upgrading to php 8.1

php check.php
PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/www/librenms/html/plugins/Weathermap/check.php on line 261
git pull
Already up to date.

Fresh install of Ubuntu 22.04.1 LTS with PHP 8.1.2 and the latest merged updates from Multiple fixes by LoveSkylark · Pull Request #82 · librenms-plugins/Weathermap · GitHub - all works fine. Needed to install php-pear.

check.php isn’t needed for any of it, but change the curly brackets to square brackets on line 261 and it works.

Are you definitely using the correct repository including PR #82?

librenms@lnms-dev:~/html/plugins/Weathermap$ git remote -v
origin  https://github.com/librenms-plugins/Weathermap.git (fetch)
origin  https://github.com/librenms-plugins/Weathermap.git (push)
librenms@lnms-dev:~/html/plugins/Weathermap$ git log | head
commit 697ac3cdb517aedc81d3b0b2e9ae5582234dca54
Merge: 018334a aae81d0
Author: Neil Lathwood <[email protected]>
Date:   Mon Aug 22 20:44:47 2022 +0100

    Merge pull request #82 from LoveSkylark/master

    Multiple fixes

commit aae81d08d94b314915ff302c922daaf0505077bb

Hi
yes im using the same git repo and on the version as you are
the map editor is not responding when clicking on “map properties” and the updating is still stuck for the maps

bash-4.2$ pwd
/opt/librenms/html/plugins/Weathermap
bash-4.2$ git log | head
commit 697ac3cdb517aedc81d3b0b2e9ae5582234dca54
Merge: 018334a aae81d0
Author: Neil Lathwood [email protected]
Date: Mon Aug 22 20:44:47 2022 +0100

Merge pull request #82 from LoveSkylark/master

Multiple fixes

commit aae81d08d94b314915ff302c922daaf0505077bb
bash-4.2$ git remote -v
origin GitHub - librenms-plugins/Weathermap (fetch)
origin GitHub - librenms-plugins/Weathermap (push)

bash-4.2$ ./validate.php

Component Version
LibreNMS 22.9.0
DB Schema 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
PHP 8.1.10
Python 3.6.8
Database MariaDB 10.5.17-MariaDB
RRDTool 1.4.8
SNMP 5.7.2

====================================

[OK] Composer Version: 2.4.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK]
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrdtool version ok
[OK] Connected to rrdcached

[root@librenms-prod networking]# systemctl restart httpd
[root@librenms-prod networking]# yum list installed | grep php
gd3php.x86_64 2.3.3-7.el7.remi @remi-safe
oniguruma5php.x86_64 6.9.8-1.el7.remi @remi-safe
php.x86_64 8.1.10-1.el7.remi @remi-php81
php-bcmath.x86_64 8.1.10-1.el7.remi @remi-php81
php-cli.x86_64 8.1.10-1.el7.remi @remi-php81
php-common.x86_64 8.1.10-1.el7.remi @remi-php81
php-devel.x86_64 8.1.10-1.el7.remi @remi-php81
php-fpm.x86_64 8.1.10-1.el7.remi @remi-php81
php-gd.x86_64 8.1.10-1.el7.remi @remi-php81
php-mbstring.x86_64 8.1.10-1.el7.remi @remi-php81
php-mysqlnd.x86_64 8.1.10-1.el7.remi @remi-php81
php-opcache.x86_64 8.1.10-1.el7.remi @remi-php81
php-pdo.x86_64 8.1.10-1.el7.remi @remi-php81
php-pear.noarch 1:1.10.13-1.el7.remi @remi-php81
php-pecl-igbinary.x86_64 3.2.7-1.el7.remi.8.1 @remi-php81
php-pecl-memcache.x86_64 8.0-3.el7.remi.8.1 @remi-php81
php-pecl-msgpack.x86_64 2.2.0~RC1-4.el7.remi.8.1 @remi-php81
php-pecl-redis5.x86_64 5.3.7-1.el7.remi.8.1 @remi-php81
php-pecl-zip.x86_64 1.21.1-1.el7.remi.8.1 @remi-php81
php-process.x86_64 8.1.10-1.el7.remi @remi-php81
php-sodium.x86_64 8.1.10-1.el7.remi @remi-php81
php-xml.x86_64 8.1.10-1.el7.remi @remi-php81

I still have issues after git pull on weathermap plugin too,

error seems to be different depending on what map you are rendering
e.g some you have loads of depreciation warnings, seem to complete, but then i get empty image. Other weathermaps which are more complex i get a php fatal error

PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /opt/librenms/librenms/html/plugins/Weathermap/lib/WeatherMapLink.class.php:162
Stack trace:
#0 /opt/librenms/librenms/html/plugins/Weathermap/lib/WeatherMapLink.class.php(426): WeatherMapLink->DrawComments()
#1 /opt/librenms/librenms/html/plugins/Weathermap/lib/Weathermap.class.php(3403): WeatherMapLink->Draw()
#2 /opt/librenms/librenms/html/plugins/Weathermap/weathermap.php(296): WeatherMap->DrawMap()
#3 {main}
  thrown in /opt/librenms/librenms/html/plugins/Weathermap/lib/WeatherMapLink.class.php on line 162

ive upgraded php to 8.2.0 and now the editor works good and the buttons are responsive, but the maps still dont update

bash-4.2$ ./validate.php

Component Version
LibreNMS 22.9.0-1-gb993f38
DB Schema 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
PHP 8.2.0RC2
Python 3.6.8
Database MariaDB 10.5.17-MariaDB
RRDTool 1.4.8
SNMP 5.7.2

====================================

[OK] Composer Version: 2.4.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK]
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrdtool version ok
[OK] Connected to rrdcached
bash-4.2$

could it be a permission problem? i tried all the known methods here
im running centos7

[root@librenms-prod networking]# cd /opt/librenms/html/plugins/Weathermap/
[root@librenms-prod Weathermap]# ls -l
total 376
-rwxr-xr-x. 1 librenms librenms 38807 Sep 23 07:53 CHANGES
-rw-r–r–. 1 librenms librenms 1631 Sep 23 07:53 check-gdbug.php
-rwxr-xr-x. 1 librenms librenms 12829 Sep 23 07:53 check.php
-rw-r–r–. 1 librenms librenms 821 Sep 23 15:14 config.inc.php
drwxrwxr-x. 2 librenms librenms 4096 Sep 23 07:53 configs
-rw-r–r–. 1 librenms librenms 18011 Oct 2 2018 COPYING
-rwxr-xr-x. 1 librenms librenms 14883 Sep 23 07:53 data-pick.php
-rw-r–r–. 1 librenms librenms 940 Oct 2 2018 defaults.inc.php
drwxr-xr-x. 10 librenms librenms 182 Sep 23 07:53 docs
drwxr-xr-x. 2 librenms librenms 23 Sep 23 07:53 editcache
-rwxr-xr-x. 1 librenms librenms 51131 Sep 23 07:53 editor.php
drwxr-xr-x. 2 librenms librenms 4096 Sep 23 07:53 editor-resources
drwxrwxrwx. 2 librenms librenms 8192 Sep 23 07:53 images
-rw-r–r–. 1 librenms librenms 59 Sep 23 07:53 index.php
-rw-r–r–. 1 librenms librenms 2038 Sep 23 07:53 INSTALL.md
drwxr-xr-x. 5 librenms librenms 4096 Sep 23 07:53 lib
drwxr-xr-x. 12 librenms librenms 4096 Sep 23 15:12 LibreNMS-Weathermap
-rw-r–r–. 1 librenms librenms 1091 Sep 23 07:53 LICENSE
-rwxr-xr-x. 1 librenms librenms 4991 Sep 23 15:14 map-poller.php
drwxr-xr-x. 2 librenms librenms 4096 Sep 23 07:53 output
-rw-r–r–. 1 librenms librenms 49243 Sep 23 07:53 overlib.js
-rw-r–r–. 1 librenms librenms 50734 Oct 5 2018 overlib.js.back
drwxr-xr-x. 2 librenms librenms 4096 Sep 23 07:53 random-bits
-rw-r–r–. 1 librenms librenms 1975 Sep 23 07:53 README.md
-rw-r–r–. 1 librenms librenms 18811 Sep 23 07:53 TODO
-rw-r–r–. 1 librenms librenms 1882 Sep 23 07:53 TODO-for-0.98.md
drwxr-xr-x. 4 librenms librenms 90 Sep 23 07:53 vendor
drwxr-xr-x. 12 librenms librenms 4096 Sep 23 13:57 Weathermap
-rw-r–r–. 1 librenms librenms 1309 Oct 2 2018 Weathermap.inc.php
-rwxr-xr-x. 1 librenms librenms 10080 Sep 23 07:53 weathermap.php
-rw-r–r–. 1 librenms librenms 1143 May 30 2019 Weathermap.php
-rw-rw-r–. 1 librenms librenms 3184 Jan 5 2022 weathermap.png
[root@librenms-prod Weathermap]#

I’m in the same position as axsis_leet but on php8.1 - basically I can open the editor but nothing happens when click the buttons, also the maps don’t update

./validate.php

Component Version
LibreNMS 22.9.0-14-gf60b6788d
DB Schema 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
PHP 8.1.10
Python 3.8.10
Database MariaDB 10.3.34-MariaDB-0ubuntu0.20.04.1
RRDTool 1.7.2
SNMP 5.8

====================================

[OK] Composer Version: 2.4.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK]
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service is enabled
[OK] Locks are functional
[OK] Python wrapper cron entry is not present
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok

There’s my validate.php. Am running Ubuntu 20.04 LTS all was fine up until the upgrade to php8.1. Any help on this would be greatly appreciated. Also first time poster so apologies if formatting is incorrect etc. and let me know if you need more information.

Also I’m running nginx with this install.

Hi,

I had the same problem and then I discovered that the error is associated with the type of data (BWLABEL ) presented in the links, if you selected BWLABEL bits; it does not present the editor, but if you go to the code and comment or remove it change the default (percentage) you will already have the editor back, after editing back to bit, I’ve been doing this since updating php.

/opt/librenms/html/plugins/Weathermap/configs/<mapname.config>

TEMPLATE-only LINKs:

LINK DEFAULT
WIDTH 5
BWFONT 1
COMMENTFONT 100
BWLABEL bits

1 Like

Hi I am also having issue.

I pulled from master. Chown all files to librenms. Fixed directories executable bit. Added php to cron job for map-poller.php script.

Editor works ok. But maps are without link usage values. I guess the issue is in

ERROR: realpath(XXXX.oob.XXX.local/port-id1106.rrd): No such file or directory

Hate to admit this but it turns out my initial issue where none of the button working in the editor is a browser issue - it doesn’t work in Microsoft Edge (surprise surprise!)

I then had another issue where it wasn’t updating I had to modify the cron job for the map-poller.php execution to the following:

*/5 * * * * librenms php /opt/librenms/html/plugins/Weathermap/map-poller.php >> /dev/null 2>&1

Hopefully some of you other guys get your issues fixed!

1 Like

HI,

I did the exact same.

But my maps have no data.

Do your maps show link utilization?

If I run the map-poller from CLI I see among other ERROR: realpath(172.16.56.1/port-id14480.rrd): No such file or directory.

Hey,

Yeah all my maps are showing utilization fine I just had the issue with them not uodating also I dont get that error when I run the map-poller.php manually.

Sorry I cant help further.

I’m also experiencing the same issue and have not been able to solve it yet.

So I was poking around some more this morning in relation to the maps not showing any link data. If I comment out the $rrdcached in the /opt/librenms/config.php after about 15 minutes my map will return to normal.

I suspect there is a path issue between the $rrdcached or possibly a permissions issue? but there is nothing related in the installation/configuration notes for Weathermap that pertains to rrdcached.

1 Like

Same effect on my site. Thank you.