librenms-plugins / Weathermap

MIT License
64 stars 51 forks source link

LibreNMS with php8.1 crash at Weathermap installation #78

Closed fbouynot closed 1 year ago

fbouynot commented 2 years ago

Hello,

It is the same issue than #76 but it was closed without solution given by the user. I'm using CentOS Stream 8 with php8.1.5 from remi repo, nginx 1.14.1, MariaDB 10.3.28, Laravel 8.80.0, RRDTool 1.7.0, and LibreNMS 22.4.0-18-g70bae6605 with 2022_04_08_085504_isis_adjacencies_table_add_index (236) database schema. If I install weathermap with LibreNMS documentation, LibreNMS fall in error state with error 500 and ksort(): Argument #1 ($array) must be of type array, null given log. At the moment I delete Weathermap folder, LibreNMS is working again. @cabello123 says to solved the issue by "adding missing arrays to the function".

Does someone know where does it come from?

dgeo commented 2 years ago

same here with php 8.0

rvstaveren commented 2 years ago

Made a pull request in #79 for this

kaude101 commented 2 years ago

i have the same issue can anybody help me below the output from the cli:

`librenms@nmserver:~$ ./validate.php

Component Version
LibreNMS 22.7.0-9-g799c03df2
DB Schema 2022_07_19_081224_plugins_unique_index (244)
PHP 8.1.2
Python 3.10.4
MySQL 10.6.7-MariaDB-2ubuntu1.1
RRDTool 1.7.2
SNMP 5.9.1

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

[OK] Composer Version: 2.3.10 [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] rrd_dir is writable [OK] rrdtool version ok [WARN] Your install is over 24 hours out of date, last update: Fri, 22 Jul 2022 21:31:27 +0000 [FIX]: Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.`

librenms@nmserver:~$ ./daily.sh Updating to latest codebase OK Updating Composer packages OK Updated from 799c03df2 to 7071db98a OK Updating SQL-Schema OK Updating submodules OK Cleaning up DB OK Fetching notifications OK Caching PeeringDB data OK Caching Mac OUI data OK

i flow steps on https://docs.librenms.org/Extensions/Weathermap/ when i try to enable plugin frow webGUI i have this mesage

Whoops, looks like something went wrong. Check your librenms.log.

LoveSkylark commented 2 years ago

in WeatherMap.functions.php I had to change line 1517 from: if ($number == 0 ) to: if ($number == 0 || !is_int($number))

or the everything breaks when you switch form: "map style>link lablel>percentage" to "map style>link lablel>bits/sec"

LoveSkylark commented 1 year ago

I have working Weathermap at LoveSkylark/LibreNMS-Weathermap please test it out and let me know if find any more issue, I will make a pull request as soon as I'm more confident it is working properly.

Note: this contains a fix for remote rrdchaced as well

omorfin commented 1 year ago

Hello, I just tested and it still doesn't work for me. I have this error with active debug :

{ "message": "Unsupported operand types: string / int", "exception": "TypeError", "file": "/opt/librenms/html/plugins/Weathermap/lib/WeatherMap.functions.php", "line": 1593, "trace": [ { "file": "/opt/librenms/html/plugins/Weathermap/lib/WeatherMap.functions.php", "line": 149, "function": "nice_scalar" }, { "file": "/opt/librenms/html/plugins/Weathermap/lib/Weathermap.class.php", "line": 698, "function": "mysprintf" }, { "file": "/opt/librenms/html/plugins/Weathermap/lib/WeatherMapLink.class.php", "line": 485, "function": "ProcessString", "class": "WeatherMap", "type": "->" }, { "file": "/opt/librenms/html/plugins/Weathermap/lib/Weathermap.class.php", "line": 3403, "function": "Draw", "class": "WeatherMapLink", "type": "->" }, { "file": "/opt/librenms/html/plugins/Weathermap/editor.php", "line": 1065, "function": "DrawMap", "class": "WeatherMap", "type": "->" } ] }

omorfin commented 1 year ago

I found what is causing the problem in my case... it is when i set "Link Labels" value to "Bit/s". With "percent" or "none", it works.

Pluppo commented 1 year ago

Hello, I just tested and it still doesn't work for me. I have this error with active debug :

{ "message": "Unsupported operand types: string / int", "exception": "TypeError", "file": "/opt/librenms/html/plugins/Weathermap/lib/WeatherMap.functions.php", "line": 1593, "trace": [ { "file": "/opt/librenms/html/plugins/Weathermap/lib/WeatherMap.functions.php", "line": 149, "function": "nice_scalar" }, { "file": "/opt/librenms/html/plugins/Weathermap/lib/Weathermap.class.php", "line": 698, "function": "mysprintf" }, { "file": "/opt/librenms/html/plugins/Weathermap/lib/WeatherMapLink.class.php", "line": 485, "function": "ProcessString", "class": "WeatherMap", "type": "->" }, { "file": "/opt/librenms/html/plugins/Weathermap/lib/Weathermap.class.php", "line": 3403, "function": "Draw", "class": "WeatherMapLink", "type": "->" }, { "file": "/opt/librenms/html/plugins/Weathermap/editor.php", "line": 1065, "function": "DrawMap", "class": "WeatherMap", "type": "->" } ] }

I have the exact same error message when trying to edit a map using the editor. I tried changing BWLABEL in the .conf file from bits to percent, and that did let me see the map. But after that I'm unable to click on anything, none of the menu items, nodes or links can be clicked.

LoveSkylark commented 1 year ago

I have the exact same error message when trying to edit a map using the editor. I tried changing BWLABEL in the .conf file from bits to percent, and that did let me see the map. But after that I'm unable to click on anything, none of the menu items, nodes or links can be clicked.

I think I got this solved try it again

rcmcronny commented 1 year ago

For me, this seems to work fine, map is visible and i can edit elements. So good catch.

LoveSkylark commented 1 year ago

For me, this seems to work fine, map is visible and i can edit elements. So good catch.

No it broke the map, all the number are now 0 for me, but I think the the last change fixed that.

rcmcronny commented 1 year ago

the commit, which makes the numbers to 0 was AFTER my comment, the change 25 min ago restores this, so i have alread the now right version :) So my comment stay valid. Thanks for your work.

Pluppo commented 1 year ago

I have the exact same error message when trying to edit a map using the editor. I tried changing BWLABEL in the .conf file from bits to percent, and that did let me see the map. But after that I'm unable to click on anything, none of the menu items, nodes or links can be clicked.

I think I got this solved try it again

It turns out the issue was related to an extension in my Chrome browser (Snow Web Application Metering), works fine without it. This extension was automatically installed by company policy without my knowledge, so it took me a bit of time before I understood why it was not working.

fbouynot commented 1 year ago

It works fine with https://github.com/librenms-plugins/Weathermap/pull/82

fbouynot commented 1 year ago

Can you try https://github.com/fbouynot/Weathermap ?

Le mer. 7 sept. 2022, 18:17, jdsemma @.***> a écrit :

I've done a git pull so have up to date Weathermap, and after updating to php8.1 my librenms validate.php is clean. I had to edit BWLABEL to change it to "percent" before I could edit maps again. However, weathermap does not seem to be running to create images. I checked cron, and if I run map-poller.php by hand it errors:

./map-poller.php: line 1: ?php: No such file or directory ./map-poller.php: line 3: syntax error near unexpected token (' ./map-poller.php: line 3: // Copyright (C) 2013 Neil Lathwood @.***'

— Reply to this email directly, view it on GitHub https://github.com/librenms-plugins/Weathermap/issues/78#issuecomment-1239607143, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEQT6OBJU52B6BZTG6DCA3V5C5ZDANCNFSM5ULGBM2A . You are receiving this because you modified the open/close state.Message ID: @.***>