Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Apr 28, 2017 10:57 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Couldn't add a map file
PostPosted: Sat Sep 03, 2016 10:56 pm 
Offline

Joined: Sat Sep 03, 2016 10:28 pm
Posts: 7
Hello,

I am new to weathermap and I couldn't add a new map successfully.
It didn't show the "config file" and "title" after adding the new map.

Here are the current Cacti configuration.

Cacti version : 0.8.8f
OS : Ubuntu 16.04.1 LTS
PHP version : 5.6.25
Apache version : 2.4.18
MySQL version : 5.7.13
Weathermap version: 0.98

Here are the log messages in /var/log/apache2/error.log file

[Sun Sep 04 11:24:10.344344 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP Warning: mysql_insert_id(): Access denied for user ''@'localhost' (using password: NO) in /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php on line 843, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344361 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP Stack trace:, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344371 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP 1. {main}() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:0, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344380 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP 2. add_config() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:274, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344389 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP 3. mysql_insert_id() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:843, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344416 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP Warning: mysql_insert_id(): A link to the server could not be established in /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php on line 843, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344426 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP Stack trace:, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344435 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP 1. {main}() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:0, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344444 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP 2. add_config() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:274, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Sun Sep 04 11:24:10.344453 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP 3. mysql_insert_id() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:843, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker



Anyone can help on this issue?
Thanks so much.


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Sun Sep 04, 2016 5:00 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5091
Location: United Kingdom
Code:
[Sun Sep 04 11:24:10.344344 2016] [:error] [pid 4683] [client 192.168.1.102:52021] PHP Warning: mysql_insert_id(): Access denied for user ''@'localhost' (using password: NO) in /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php on line 843, referer: http://192.168.1.105/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker


This is strange. It looks like the mysql user can't write to the database (mysql perms, not linux perms). It also looks like there is no username, just '' there.

Is this with Cacti installed from Ubuntu packages? Config files move around in the packaged version.

_________________
Weathermap 0.98 is out! & QuickTree 0.2. Superlinks is over there now.
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Sun Sep 04, 2016 6:45 am 
Offline

Joined: Sat Sep 03, 2016 10:28 pm
Posts: 7
Hi Howie,

Yes, Cacti installed from Ubuntu packages.
I installed it with this command => apt-get install cacti cacti-spine

How can I fix this issue?


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Sun Sep 04, 2016 7:08 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5091
Location: United Kingdom
I don't know, but I can test on a VM now.

_________________
Weathermap 0.98 is out! & QuickTree 0.2. Superlinks is over there now.
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Sun Sep 04, 2016 7:25 am 
Offline

Joined: Sat Sep 03, 2016 10:28 pm
Posts: 7
Thanks Howie. 8) :D


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Sun Sep 04, 2016 10:01 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5091
Location: United Kingdom
And how did you install PHP 5.6 (that's not the default for Ubuntu 16.04, or even in the default package repo)? Then I can recreate your environment properly.

_________________
Weathermap 0.98 is out! & QuickTree 0.2. Superlinks is over there now.
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Sun Sep 04, 2016 7:39 pm 
Offline

Joined: Sat Sep 03, 2016 10:28 pm
Posts: 7
Yes, you are right. PHP5.6 isn't the default package for Ubuntu 16.04.

I used the method that mention in the following URL.

http://askubuntu.com/questions/756879/cant-install-php5-on-ubuntu-16-04

Using PHP PPA to coinstall PHP 5.6 with PHP 7.0
=> sudo add-apt-repository ppa:ondrej/php
=> sudo apt-get update
=> sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-
mod-php5.6 libapache2-mod-php7.0

Switch PHP version ( Apache ):
from php5.6 to php7.0:
=>sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
from php7.0 to php5.6:
=>sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Sun Sep 04, 2016 7:57 pm 
Offline

Joined: Sat Sep 03, 2016 10:28 pm
Posts: 7
BTW, I also installed the following packages.

apt-get install php5.6-common php5.6-cli php5.6-xml php5.6-snmp php5.6-gd

Besides, I remove the php symbolic link that pointing to /usr/bin/php7.0

rm /etc/alternatives/php

And add another php symbolic link that pointing to /usr/bin/php5.6

ln -s /usr/bin/php5.6 php5.6 php


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Mon Sep 05, 2016 2:33 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5091
Location: United Kingdom
Thanks - I can reproduce now. I created a github issue for this (I'll update this thread too though - I just wanted somewhere searchable to save the details)

https://github.com/howardjones/network-weathermap/issues/38

_________________
Weathermap 0.98 is out! & QuickTree 0.2. Superlinks is over there now.
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Mon Sep 05, 2016 2:56 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5091
Location: United Kingdom
The Debian/Ubuntu package configures Cacti to use mysqli instead of mysql. Weathermap uses mysql_ (in this version) throughout. This specific error can be fixed by replacing `mysql_insert_id()` with `db_fetch_insert_id()` on line 843 of `weathermap-cacti-plugin-mgmt.php`, but you will immediately hit other issues with `mysql_real_escape_string` which is more widely used (nearly anywhere a value is changed in the database).

The next release replaces all of this with PDO for all database access in Weathermap.

The fixes are:

1) wait for 0.98a which doesn't use the same database code for other reasons anyway.

or 2) get Cacti to use the older 'mysql' driver, which the source-installed version does by default. However, I just tried changing the line in the /etc/cacti/debian.php file back to mysql from mysqli and the adodb files for that are missing too, even though the php extension is present, so it isn't that straightforward.

_________________
Weathermap 0.98 is out! & QuickTree 0.2. Superlinks is over there now.
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Mon Sep 05, 2016 7:04 pm 
Offline

Joined: Sat Sep 03, 2016 10:28 pm
Posts: 7
Thanks a lot!
I understand now.
I better wait for 0.98a.
May I know the earliest possible release day of 0.98a? :lol:


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Tue Sep 06, 2016 2:20 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5091
Location: United Kingdom
:lol:

Actually, I just removed the last "old style" database code. I still need to go through the data source plugins (some use DB access) and obviously lots of testing. So - maybe next week earliest?

_________________
Weathermap 0.98 is out! & QuickTree 0.2. Superlinks is over there now.
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Wed Sep 07, 2016 6:13 am 
Offline

Joined: Sat Sep 03, 2016 10:28 pm
Posts: 7
Thank you for your hard working.
Can't wait to hear your good news. 8)


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Wed Mar 29, 2017 4:10 pm 
Offline

Joined: Wed Mar 29, 2017 9:36 am
Posts: 5
I have just run into this problem or something very much like it. When I try to add example.conf nothing happens and through the editor when i try to create a config file it does not populate in the directory.


I am running
cacti 0.8.8f
weathermaps 0.98
mysql 5.7.17
ubuntu 16.04
php 5.6

I was getting these two errors initially in the cacti log

03/29/2017 02:57:54 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1064', SQL:"update weathermap_maps set filehash=LEFT(MD5(concat(id,configfile,rand())),20) where id='
03/29/2017 02:57:54 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1064', SQL:"insert into weathermap_auth (mapid,userid) VALUES (,1)'


Thanks to this post I looked in /var/log/apache2/error.log and found

[Wed Mar 29 14:57:54.648253 2017] [:error] [pid 24418] [client 10.3.7.118:2772] PHP Warning: mysql_insert_id(): A link to the server could not be established in /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php on line 843, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Wed Mar 29 14:57:54.648260 2017] [:error] [pid 24418] [client 10.3.7.118:2772] PHP Stack trace:, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Wed Mar 29 14:57:54.648267 2017] [:error] [pid 24418] [client 10.3.7.118:2772] PHP 1. {main}() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:0, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Wed Mar 29 14:57:54.648275 2017] [:error] [pid 24418] [client 10.3.7.118:2772] PHP 2. add_config() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:274, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker
[Wed Mar 29 14:57:54.648282 2017] [:error] [pid 24418] [client 10.3.7.118:2772] PHP 3. mysql_insert_id() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin-mgmt.php:843, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin-mgmt.php?action=addmap_picker




So i took some of the recommended action replacing the bits of PHP code replacing `mysql_insert_id()` with `db_fetch_insert_id()` on line 843 of `weathermap-cacti-plugin-mgmt.php`

then further replacing `mysql_real_escape_string` with `mysqli_real_escape_string`

I did this using sed while in /usr/share/cacti/site/plugins/weathermap/ like this:


sed 's/mysql_insert_id/db_fetch_insert_id/g' weathermap*

and

sed 's/mysql_real_escape_string/mysqli_real_escape_string/g' weathermap*

now I see that output/ is populated with the various files put there by example.conf and I am nolonger getting any errors in the cacti log but I still dont see and filename in the map manager through cacti and I get a "broken image" icon at the top of the map.


I feel like Im getting closer to fixing this but I am at somewhat of a loss is there anything further you can recommend to help?

also when do you expect to release 0.98a?


p.s. I am now seeing

[Wed Mar 29 15:20:21.367770 2017] [:error] [pid 26167] [client 10.3.7.118:3277] PHP Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin.php on line 654, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin.php
[Wed Mar 29 15:20:21.367777 2017] [:error] [pid 26167] [client 10.3.7.118:3277] PHP Stack trace:, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin.php
[Wed Mar 29 15:20:21.367784 2017] [:error] [pid 26167] [client 10.3.7.118:3277] PHP 1. {main}() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin.php:0, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin.php
[Wed Mar 29 15:20:21.367793 2017] [:error] [pid 26167] [client 10.3.7.118:3277] PHP 2. weathermap_translate_id() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin.php:27, referer: http://10.3.7.117/cacti/plugins/weathermap/weathermap-cacti-plugin.php
[Wed Mar 29 15:20:21.367801 2017] [:error] [pid 26167] [client 10.3.7.118:3277] PHP 3. mysqli_real_escape_string() /usr/share/cacti/site/plugins/weathermap/weathermap-cacti-plugin.php:654, referer: http://10.3.7.117/cacti/plugins/


in /var/log/apache2/error.log


Top
 Profile  
 
 Post subject: Re: Couldn't add a map file
PostPosted: Wed Mar 29, 2017 4:39 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5091
Location: United Kingdom
If you are using php 5.6, you can use "mysql" instead of "mysqli" for the database type in the cacti config.php, which solves the problem by going backwards :-)

Or you could live life on the edge and try the not-really-supported-or-finished dev version, which is nearly all converted to use PDO now:
https://github.com/howardjones/network- ... e-refactor

_________________
Weathermap 0.98 is out! & QuickTree 0.2. Superlinks is over there now.
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group