Install weathermap plugin on cacti 0.8.8a

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
romgo1
Posts: 9
Joined: Tue Mar 19, 2013 10:15 am

Install weathermap plugin on cacti 0.8.8a

Post by romgo1 »

Hello,

I am currently trying to install weathermap version 0.97a on my cacti 0.8.8a.
I deployed the weathermap folder in plugins/ directory.

On the cacti interface I go to Plugin Management => click on action to ative the plugin.

Weathermap appears in the top front bar.
When I go in management => weathermap => Add => select simple.conf nothing happens.


Following a post on the forum (http://forums.cacti.net/viewtopic.php?f=16&t=47347) I changed the setup.php from TYPE to ENGINE.
But the tables are still not created.

I don't see any logs about issue (I activated the debug log level in cacti).

Any idea ?

Regards
romgo1
Posts: 9
Joined: Tue Mar 19, 2013 10:15 am

Re: Install weathermap plugin on cacti 0.8.8a

Post by romgo1 »

Ok I found the solution :

In order to found the source of the issue, I had to comment out the test :

Code: Select all

254         // only bother with all this if it's a new install, a new version, or we're in a development version
255         // - saves a handful of db hits per request!
256         //if( ($dbversion=="") || (preg_match("/dev$/",$myversion)) || ($dbversion != $myversion) )
without that I was always skipping database setup (not sure to know why).
after that i found in the log file :

Code: Select all

CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1146', SQL:"update weathermap_maps set sortorder=id where sortorder is null;'
When I comment this line database setup is working (I tried with ENGINE=MyIsam).


This error make sens as the tables doesn't exist at this time right ?

Hope this help.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Install weathermap plugin on cacti 0.8.8a

Post by Howie »

Yes - the version check assumes that the previous create table commands worked... :oops:

0.97b fixes the original problem (TYPE vs ENGINE) - hopefully out this week. I've got the week off work, and it's my 'job' this week. :-)
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
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!)
icethink
Posts: 5
Joined: Wed Feb 20, 2013 8:34 pm

Re: Install weathermap plugin on cacti 0.8.8a

Post by icethink »

I read weathermap 0.97(org,a,b,c) source code.

Code: Select all

function weathermap_setup_table () {
if( ($dbversion=="") || (preg_match("/dev$/",$myversion)) || ($dbversion != $myversion) )
{
1) $dbversion is alway 0.97X(abc),this value is made by plugin.php
2) preg_match("/dev$/",$myversion), it make no sense for normal user.
3) $dbversion != $myversion is nerver true,because 1)

SQL "CREATE table XXXXXX..." world never work。
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Install weathermap plugin on cacti 0.8.8a

Post by Howie »

icethink wrote:I read weathermap 0.97(org,a,b,c) source code.

Code: Select all

function weathermap_setup_table () {
if( ($dbversion=="") || (preg_match("/dev$/",$myversion)) || ($dbversion != $myversion) )
{
1) $dbversion is alway 0.97X(abc),this value is made by plugin.php
2) preg_match("/dev$/",$myversion), it make no sense for normal user.
3) $dbversion != $myversion is nerver true,because 1)

SQL "CREATE table XXXXXX..." world never work。
If dbversion is 0.97a and myversion is 0.97c, then 3 is true. This is the intended logic. In other words, you have a version installed, and you have updated, so there are database modifications.

dbversion is NOT set by plugin architecture:

Code: Select all

$dbversion = read_config_option("weathermap_db_version");
it is an entry in the settings table, put there by the weathermap_setup_table() function.

#1 is for new installs (nothing in the database yet) dbversion is set during this function, so initially it is blank.

#2 is for me, so that dev versions always do a full check for database tables.

#3 is for upgrades (different version in DB than in running code)
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
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!)
icethink
Posts: 5
Joined: Wed Feb 20, 2013 8:34 pm

Re: Install weathermap plugin on cacti 0.8.8a

Post by icethink »

Thank you for your relay.
Yes ,you are right.I have a mistake in 1)
And I have a solution like this

Code: Select all

weathermap_setup_table($iscreate=false){
...
if( ($dbversion=="") || (preg_match("/dev$/",$myversion)) || ($dbversion != $myversion) || $iscreate){
...
}
..
in install function

Code: Select all

regist_hook
regist_hook
regist_hook
weathermap_setup_table([color=#FF0000]true[/color]);
but I have another problem.
SQL='CREATE TABLE ........) type=Myisam;'
synax error
SQL='CREATE TABLE ........) engine=Myisam;'
It works!

but MySQL official manual said both key wordtype and engine works.
I run sql on MySQL 5.3
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Install weathermap plugin on cacti 0.8.8a

Post by Howie »

I don't understand what your solution is the solution to.

The mysql type vs engine: I think it depends if you have strict mode enabled in mysql. At some point about a year ago I started getting lots of reports like this about tables not being created.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
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!)
Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests