Something missing in SQL


Hi All,

Have a new install of Weathermap 0.98 on Cacti 0.8.8h. Editor web interface in Cacti appears to be working OK, but encountering errors trying to put configured map in a group to display.

If I create/edit a group, name is always blank (though does display if I update in SQL). If I add a map to a group, do see SQL errors:

DB Exec Failed!, Error:‘1064’, SQL:"update weathermap_maps set filehash=LEFT(MD5(concat(id,configfile,rand())),20) where id=‘
A DB Exec Failed!, Error:‘1064’, SQL:"insert into weathermap_auth (mapid,userid) VALUES (,1)’

…I can update access for maps, after adding to group, but “Title” remains blank. Seem to be a few details missing from weathermap_maps table:

+----+-----------+----------+--------+------------+-----------+----------+------------+----------+-----------+--------+-------------+-------------    -+----------+-----------+
 | id | sortorder | group_id | active | configfile | imagefile | htmlfile | titlecache | filehash | warncount | config | thumb_width | thumb_height | schedule | archiving |
+----+-----------+----------+--------+------------+-----------+----------+------------+----------+-----------+--------+-------------+-------------    -+----------+-----------+
|  3 |         1 |        1 | on     |            |           |          |            |          |         0 |        |           0 |            0 | *        | off       |
+----+-----------+----------+--------+------------+-----------+----------+------------+----------+-----------+--------+-------------+--------------    +----------+-----------+

Have tried remmove/reinstall which appears to remove and recreate tables OK, any suggestions as to where it’s losing these variables when trying to manage maps?



This rings a bell. Someone else had a similar issue, and I don’t recall the solution. It was on the Cacti forums. With no filehash and no configfile, things will not go well.

Which version of PHP is this with? I think it was something related to PHP 7 and mysql_escape_string() (which is no longer there in PHP 7)


Extremely close it turns out. I am running on PHP5.6 (though I did just realise CLI php on my system was defaulted to 7.0, have corrected that, was probably causing issues for cron php jobs). Saw these in error logs when creating a new map:

PHP Warning:  mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO) in /usr/local/share/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php on line 837, referer: http://sensvrmon2/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
PHP Warning:  mysql_insert_id(): A link to the server could not be established in /usr/local/share/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php on line 843, referer: http://sensvrmon2/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker

Realised I’d chosen mysqli when installing Cacti, so no legacy MySQL connection available. Changed Cacti to plain MySQL and looks like it’s working now.

Thanks for the help!