WeatherMap editor and php 8.1 : incompatibility?

Mine is throwing the following error when I try to access the editor:

{
“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 the same issue with the path not working, the relative path ./devicename/port.rrd gives a not found error. I have not tried commenting out the $config[‘rrdcached’] but i am running in a distributed rrd cache so i wouldnt want to comment that out unless this was no longer controlled by the config file.

I seemed to have repaired my maps by adding the Global setting to all the map config files:
SET rrd_default_path "/opt/librenms/rrd/"

you can do something like

for i in `ls *.conf`
do
sed -i '/^# End of global section/i SET rrd_default_path "/opt/librenms/rrd/"' $i
done

or if you want to check it over rather than in place edit

for i in `ls *.conf`
do
sed '/^# End of global section/i SET rrd_default_path "/opt/librenms/rrd/"' > $i.new
done
3 Likes

That fixed it for me! (At least apparently, as I’m getting numbers now!)

Thanks

Unfortunately, this did not fix my Weathermap editor. I’m still getting the same error I posted above.

This (git pull in the Weathermap directory) did it for me; had to su to the librenms account first but then that fixed the error from the editor… but now my graphs are spitting out 0s.

I’m getting a bunch of errors from the map-poller.php like:

ERROR: realpath(foo-rtr01.mgmt.example.net/port-id107.rrd): No such file or directory
WARNING: configs//default.conf: RRD ReadData: At least one of your DS names (INOCTETS and OUTOCTETS) were not found, even though there was a valid data line. Maybe they ar
e wrong? Valid DS names in this file are:  [WMRRD06]
WARNING: configs//default.conf: ReadData: LINK foo-rtr01_to_dc01-core01, target: ./foo-rtr01.mgmt.example.net/port-id107.rrd:INOCTETS:OUTOCTETS on config line 176 of co
nfigs//default.conf had no valid data, according to WeatherMapDataSource_rrd
ERROR: realpath(quux-rtr01.mgmt.example.net/port-id121.rrd): No such file or directory
WARNING: configs//default.conf: RRD ReadData: At least one of your DS names (INOCTETS and OUTOCTETS) were not found, even though there was a valid data line. Maybe they ar
e wrong? Valid DS names in this file are:  [WMRRD06]
WARNING: configs//default.conf: ReadData: LINK quux-rtr01_to_dc01-core01, target: ./quux-rtr01.mgmt.example.net/port-id121.rrd:INOCTETS:OUTOCTETS on config line 1
84 of configs//default.conf had no valid data, according to WeatherMapDataSource_rrd
ERROR: realpath(baz-rtr01.mgmt.example.net/port-id207.rrd): No such file or directory
WARNING: configs//default.conf: RRD ReadData: At least one of your DS names (INOCTETS and OUTOCTETS) were not found, even though there was a valid data line. Maybe they ar
e wrong? Valid DS names in this file are:  [WMRRD06]
WARNING: configs//default.conf: ReadData: LINK baz-rtr01_to_dc01-core01, target: ./baz-rtr01.mgmt.example.net/port-id207.rrd:INOCTETS:OUTOCTETS on confi
g line 192 of configs//default.conf had no valid data, according to WeatherMapDataSource_rrd
ERROR: realpath(rivendell-rtr01.mgmt.example.net/port-id238.rrd): No such file or directory
WARNING: configs//default.conf: RRD ReadData: At least one of your DS names (INOCTETS and OUTOCTETS) were not found, even though there was a valid data line. Maybe they ar
e wrong? Valid DS names in this file are:  [WMRRD06]
WARNING: configs//default.conf: ReadData: LINK rivendell-rtr01_to_dc01-core01, target: ./rivendell-rtr01.mgmt.example.net/port-id238.rrd:INOCTETS:OUTOCTETS on config li
ne 200 of configs//default.conf had no valid data, according to WeatherMapDataSource_rrd
ERROR: realpath(quark-twr-rtr01.mgmt.example.net/port-id167.rrd): No such file or directory
WARNING: configs//default.conf: RRD ReadData: At least one of your DS names (INOCTETS and OUTOCTETS) were not found, even though there was a valid data line. Maybe they ar
e wrong? Valid DS names in this file are:  [WMRRD06]
WARNING: configs//default.conf: ReadData: LINK quark-twr-rtr01_to_dc01-core01, target: ./quark-twr-rtr01.mgmt.example.net/port-id167.rrd:INOCTETS:OUTOCTETS on config
line 208 of configs//default.conf had no valid data, according to WeatherMapDataSource_rrd
ERROR: realpath(ward-twr-rtr01.mgmt.example.net/port-id285.rrd): No such file or directory
WARNING: configs//default.conf: RRD ReadData: At least one of your DS names (INOCTETS and OUTOCTETS) were not found, even though there was a valid data line. Maybe they ar
e wrong? Valid DS names in this file are:  [WMRRD06]
WARNING: configs//default.conf: ReadData: LINK ward-twr-rtr01_to_dc01-core01, target: ./ward-twr-rtr01.mgmt.example.net/port-id285.rrd:INOCTETS:OUTOCTETS on config line
 216 of configs//default.conf had no valid data, according to WeatherMapDataSource_rrd
ERROR: realpath(pine-rtr01.mgmt.example.net/port-id2305.rrd): No such file or directory
WARNING: configs//default.conf: RRD ReadData: At least one of your DS names (INOCTETS and OUTOCTETS) were not found, even though there was a valid data line. Maybe they ar
e wrong? Valid DS names in this file are:  [WMRRD06]
WARNING: configs//default.conf: ReadData: LINK pine-rtr01_to_rivendell-rtr01, target: ./pine-rtr01.mgmt.example.net/port-id2305.rrd:INOCTETS:OUTOCTETS on config line
225 of configs//default.conf had no valid data, according to WeatherMapDataSource_rrd
ERROR: realpath(pine-rtr01.mgmt.example.net/port-id2393.rrd): No such file or directory

All of the RRD files are untouched from where they were before though… I was on Ubuntu 20.04 LTS and upgraded to 22.04 LTS and that’s what started the problems here (so mainly, the PHP version change).

This little hack (editing the individual weathermap’s .conf file to set rrd_default_path) also worked to get my (single file) working again. For those concerned, it seems like you can still used the PHP/web-based editor on the file afterwards and it does not clobber that stanza.

But I’d like to figure out how to fix it elsewhere instead of requiring that line to be manually added to the file…?

This PR does seem to take care of everything as best I can tell (using a local / unix socket rrdcached and a single poller, so the RRD files are all local too).

I honestly don’t know what (if anything) rrdcached is doing here or if weathermap.php is actually talking to it in any meaningful way, though…

This fixed my Weathermap editor, all credit goes to the author of the changes:

I’ve gotten to the point where I can open the editor now. I can make changes but they never actually save. I also can’t create new config files. Seems like a permissions issue, but validate.php checks out so I’m not sure what the problem is.

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

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

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

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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.