howardjones / network-weathermap

Network Weathermap draws diagrams from data
http://www.network-weathermap.com/
MIT License
425 stars 94 forks source link

thold columns renamed@Cacti1.x version #73

Closed jpobeda closed 7 years ago

jpobeda commented 7 years ago

Hi Howie,

I'm openning a new issue to keep it separated. I know you are not working towards Cacti 1.x yet but 1 thing less to find out.

The version of thold for cacti 1.x has renamed a couple of columns. So far the only onces I've seen affected for nwm are these:

rra_id and data_id

2017-04-24 14:11:54 - DBCALL ERROR: SQL Assoc Failed!, Error: Unknown column 'rra_id' in 'field list' 2017-04-24 14:11:54 - DBCALL ERROR: SQL Assoc Failed!, Error:1054, SQL:"select rra_id, data_id, thold_alert from thold_data,data_local where thold_data.rra_id=data_local.id and data_local.host_id=61 and thold_enabled='on'"

Based on: https://github.com/Cacti/plugin_thold/blob/master/includes/database.php

// Rename some columns db_execute('ALTER TABLE thold_data CHANGE COLUMN rra_id local_data_id int(11) UNSIGNED NOT NULL default "0"'); db_execute('ALTER TABLE thold_data CHANGE COLUMN data_id data_template_rrd_id int(11) UNSIGNED NOT NULL default "0"'); db_execute('ALTER TABLE thold_data CHANGE COLUMN template thold_template_id int(11) UNSIGNED NOT NULL default "0"'); db_execute('ALTER TABLE thold_data CHANGE COLUMN data_template data_template_id int(11) UNSIGNED NOT NULL default "0"'); db_execute('ALTER TABLE thold_data CHANGE COLUMN graph_id local_graph_id int(11) UNSIGNED NOT NULL default "0"'); db_execute('ALTER TABLE thold_data CHANGE COLUMN graph_template graph_template_id int(11) UNSIGNED NOT NULL default "0"'); db_execute('ALTER TABLE plugin_thold_log CHANGE COLUMN graph_id local_graph_id int(11) UNSIGNED NOT NULL default "0"');

I've modified the SQL query on my lib/datasources/WeatherMapDataSource_cactithold.php copy and it worked ok BUT as I understand you want to keep one single version compatible with 0.8 and 1.x. So that's over to you.

Can't help you there :/ undefined indexes.txt

howardjones commented 7 years ago

(thanks for opening a new issue - I don't understand why people don't!)

I am working towards Cacti 1.x... Thanks for the report. I will figure out a way to handle both cases - simple name changes like this shouldn't be so bad. I actually couldn't get thold installed at all on 1.x yesterday, so I haven't been able to test.

howardjones commented 7 years ago

Should be fixed now, including detection of old vs new thold.