Cacti / plugin_reportit

ReportIt Plugin for Cacti
GNU General Public License v2.0
7 stars 9 forks source link

Creating a template under Cacti 1.2 causes collation error #27

Closed netniV closed 6 years ago

netniV commented 6 years ago

When attempted to create a template the following error occurs:

2018/07/04 10:30:06 - CMDPHP SQL Backtrace: (/plugins/reportit/templates.php: 43 template_edit)(/plugins/reportit/templates.php: 744 html_template_ds_alias)(/plugins/reportit/lib/funct_html.php: 312 db_fetch_assoc_prepared)(/lib/database.php: 413 cacti_debug_backtrace)
2018/07/04 10:30:06 - DBCALL ERROR: SQL Assoc Failed!, Error: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
2018/07/04 10:30:06 - DBCALL ERROR: SQL Assoc Failed!, Error:1267, SQL:'SELECT a.id, a.data_source_name, b.data_source_alias, b.id AS enabled FROM data_template_rrd as a LEFT JOIN ( SELECT * FROM plugin_reportit_data_source_items WHERE template_id = ? ) AS b ON a.data_source_name = b.data_source_name WHERE a.local_data_id = 0 AND a.data_template_id = ?'
2018/07/04 10:29:36 - CMDPHP SQL Backtrace: (/plugins/reportit/templates.php: 43 template_edit)(/plugins/reportit/templates.php: 744 html_template_ds_alias)(/plugins/reportit/lib/funct_html.php: 312 db_fetch_assoc_prepared)(/lib/database.php: 413 cacti_debug_backtrace)
2018/07/04 10:29:36 - DBCALL ERROR: SQL Assoc Failed!, Error: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
2018/07/04 10:29:36 - DBCALL ERROR: SQL Assoc Failed!, Error:1267, SQL:'SELECT a.id, a.data_source_name, b.data_source_alias, b.id AS enabled FROM data_template_rrd as a LEFT JOIN ( SELECT * FROM plugin_reportit_data_source_items WHERE template_id = ? ) AS b ON a.data_source_name = b.data_source_name WHERE a.local_data_id = 0 AND a.data_template_id = ?'
netniV commented 6 years ago

This is caused when the default collation of the Cacti database is set a collation other than utf8mb4_unicode_ci (such as utf8mb4_general_ci or utf8_general_ci, etc). Changing the database default collation will resolve this issue but will also require changing any ReportIT tables to match.

Reinstalling the plugin will recreate the tables but any data would be lost.