librenms-plugins / Weathermap

MIT License
64 stars 51 forks source link

Can't access Weathermap Editor after upgrade to PHP 8.1 #90

Closed pepperoni-pi closed 1 year ago

pepperoni-pi commented 1 year ago

I upgraded my LibreNMS instance to PHP 8.1 relatively recently and have not been able to access the Weathermap editor since. I am getting the following error after enabling debugging.

{ "message": "Attempt to assign property \"configline\" on null", "exception": "Error", "file": "/opt/librenms/html/plugins/Weathermap/lib/Weathermap.class.php", "line": 1840, "trace": [ { "file": "/opt/librenms/html/plugins/Weathermap/editor.php", "line": 848, "function": "ReadConfig", "class": "WeatherMap", "type": "->" } ] }

I have tried the recommended actions in the LibreNMS Community but did not have any success with resolving the error.

KarlPio commented 1 year ago

I'm getting the exact same error message when I click on my editor link. Some help or a solution would be much appreciated. I'm using 0.97c version of weathermap.

pepperoni-pi commented 1 year ago

I was running "sudo -i -u librenms git pull" while in the /opt/librenms/html/plugins/Weathermap directory, but the command was actually still running in /opt/librenms. I switched to the librenms user and then ran "git pull" from the /opt/librenms/html/plugins/Weathermap directory and now my editor works again.

KarlPio commented 1 year ago

Thanks for your input pepperoni-pi. I followed your instructions above and the git pull updated my weathermap editor to version 0.98b (I'm unsure if this is a stable version). It is now loading my weathermap config files alright which is a step in the right direction, but I'm unable to edit the links, nodes or add new nodes etc... any advice on this?

pepperoni-pi commented 1 year ago

Are you able to create a new config file that is editable?

KarlPio commented 1 year ago

Thank you for your reply. I'm able to create a new config file, open the file but again I cannot edit the file, add a new node, click on a link etc.... I have ensured the php validate check for librenms user has permissions. I can also see the config file is created in the correct weathermap folder. Git pull updated the editor from 0.97 to 0.98b for me and I'm not sure if this is part of the issue. Was there any other actions you needed to take following git pull command run?

pepperoni-pi commented 1 year ago

Actually, I'm in the same boat. I can open my editor and make changes, but they never save. I also can't create a new config file using the WebUI. Behaves like a permissions issue, but like you I already ran validate to check the permissions. Not sure.

tpelado commented 1 year ago

Hey all,

I'm also having the same issue, where, upon upgrading to PHP8.1, the editor wouldn't load. I've git pulled the repo, and now I can access the editor, but I can't do anything with it.

KarlPio commented 1 year ago

Hi Guys, you need to clear the cache of your web browser (I'm using Google Chrome) and hit ctrl+F5 to refresh your web page which will then let you click on links and nodes on your editor.php page. However, the next issue I've run into now is, the html output/sub folder is not updating with the edits I make in the config files.

tpelado commented 1 year ago

Final Edit : https://community.librenms.org/t/weathermap-editor-and-php-8-1-incompatibility/19296/23 has the trick to tell it where your rrd files are.

So in summary :

KarlPio commented 1 year ago

add the shebang missing from the map-poller.php file ( #!/usr/bin/php) worked and resolved my issue. Thanks a mil for your help guys! :)

pepperoni-pi commented 1 year ago

The #!/usr/bin/php fixed it for me. I created a pull request to add that to the map-poller.php file.

pepperoni-pi commented 1 year ago

This could probably also be fixed by just changing your cron entry to have php explicitly called when running map-poller.php.

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