Cacti / plugin_reportit

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

Unable to import template from v7.5 errors from Cacti Log attached. #5

Closed ikorzha closed 6 years ago

ikorzha commented 7 years ago

2017/07/03 21:02:36 - DBCALL ERROR: SQL Save Failed for Table 'reportit_templates'. SQL:'INSERT INTO reportit_templates (id, description, pre_filter, data_template_id, data_template_alias, locked, export_folder) VALUES (0, 'Circuit Usage Report', '', 41, '', 0, '') ON DUPLICATE KEY UPDATE description=VALUES(description), pre_filter=VALUES(pre_filter), data_template_id=VALUES(data_template_id), data_template_alias=VALUES(data_template_alias), locked=VALUES(locked), export_folder=VALUES(export_folder)' 2017/07/03 21:02:36 - CMDPHP SQL Backtrace: (/plugins/reportit/cc_templates.php: 61 template_import)(/plugins/reportit/cc_templates.php: 320 sql_save)(/lib/database.php: 984 _db_replace)(/lib/database.php: 931 db_execute)(/lib/database.php: 118 db_execute_prepared)(/lib/database.php: 191 cacti_debug_backtrace) 2017/07/03 21:02:36 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'data_template_alias' in 'field list' 2017/07/03 21:02:36 - DBCALL ERROR: A DB Exec Failed!, Error:1054, SQL:'INSERT INTO reportit_templates (id, description, pre_filter, data_template_id, data_template_alias, locked, export_folder) VALUES (0, 'Circuit Usage Report', '', 41, '', 0, '') ON DUPLICATE KEY UPDATE description=VALUES(description), pre_filter=VALUES(pre_filter), data_template_id=VALUES(data_template_id), data_template_alias=VALUES(data_template_alias), locked=VALUES(locked), export_folder=VALUES(export_folder)' 2017/07/03 21:02:36 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/cc_templates.php: 61 template_import)(/plugins/reportit/cc_templates.php: 320 sql_save)(/lib/database.php: 961 CactiErrorHandler)(/lib/functions.php: 4392 cacti_debug_backtrace) 2017/07/03 21:02:36 - ERROR PHP NOTICE: Undefined index: data_template_alias in file: /var/www/html/lib/database.php on line: 961 2017/07/03 21:02:36 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/cc_templates.php: 61 template_import)(/plugins/reportit/cc_templates.php: 320 sql_save)(/lib/database.php: 960 CactiErrorHandler)(/lib/functions.php: 4392 cacti_debug_backtrace) 2017/07/03 21:02:36 - ERROR PHP NOTICE: Undefined index: data_template_alias in file: /var/www/html/lib/database.php on line: 960 2017/07/03 21:02:36 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/cc_templates.php: 61 template_import)(/plugins/reportit/cc_templates.php: 320 sql_save)(/lib/database.php: 959 CactiErrorHandler)(/lib/functions.php: 4392 cacti_debug_backtrace) 2017/07/03 21:02:36 - ERROR PHP NOTICE: Undefined index: data_template_alias in file: /var/www/html/lib/database.php on line: 959 2017/07/03 21:02:36 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/cc_templates.php: 61 template_import)(/plugins/reportit/cc_templates.php: 320 sql_save)(/lib/database.php: 958 CactiErrorHandler)(/lib/functions.php: 4392 cacti_debug_backtrace) 2017/07/03 21:02:36 - ERROR PHP NOTICE: Undefined index: data_template_alias in file: /var/www/html/lib/database.php on line: 958

browniebraun commented 7 years ago

Sorry, I will do next commitments on Monday evening, because I'm out this weekend. This plugin is so old (I believe I wrote it in 2006) so that many parts have to be re-written to get it working.

Regards -Andi

ikorzha commented 7 years ago

I will be waiting thanks :)

brgalvez commented 6 years ago

Hi Andi. Will you be releasing an update for Reportit any time soon? I recently upgraded from Cacti 0.8.8b to v1 and unfortunately the plugin for the new version is having an issue :( I hope you are still supporting the application.

image

netniV commented 6 years ago

So the my_id() function resides in funct_online.php. That file is included within reports.php as such:

include_once(REPORTIT_BASE_PATH . '/lib/funct_online.php');

The REPORTIT_BASE_PATH is defined within setup.php in the function reportit_define_constants() as such:

@define('REPORTIT_BASE_PATH', $config['base_path'] . '/plugins/reportit');

This is called in the first line of reportit_config_settings() which in turn is called from the core plugin code via the api_plugin_register_hook(). If you are getting this error it suggests that the plugin hasn't been installed and you are trying to go directly to it. Check the Plugin's section to make sure it is installed and enabled.

brgalvez commented 6 years ago

Thanks, netniV. This is what I see in the reportit_define_constants(). The plugin has the tendency to force disable when it encounters an error. Will check your recommendations.

image

netniV commented 6 years ago

If you are seeing that then you are not using the version from here. I cloned from the source yesterday and my source looks as above. I would suggest maybe renaming your plugin folder to another name as a backup and then downloading the latest release from here. Once you have that, make sure the folder is the same name of "reportit" then check it's installed and enabled.

netniV commented 6 years ago

For reference, this is the entire function as shown in the repository https://github.com/Cacti/plugin_reportit/blob/develop/setup.php#L377:

function reportit_define_constants(){
    global $config;

    /* realm IDs which have been defined dynamically by PIA 2.x */
    $ids = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin='reportit' ORDER BY id ASC");

    @define('REPORTIT_USER_ADMIN', 100 + $ids[0]['id']);
    @define('REPORTIT_USER_OWNER', 100 + $ids[1]['id']);
    @define('REPORTIT_USER_VIEWER', 100 + $ids[2]['id']);

    /* define ReportIT's base paths */
    @define('REPORTIT_BASE_PATH', $config['base_path'] . '/plugins/reportit');

    /* with regard to Cacti 0.8.8 it becomes necessarily to replace the old path settings */
    @define('CACTI_BASE_PATH', $config['base_path']);
    @define('CACTI_INCLUDE_PATH', CACTI_BASE_PATH . '/include/');

    /* path where PCLZIP will save temporary files */
    @define('REPORTIT_TMP_FD', REPORTIT_BASE_PATH . '/tmp/');
    /* path where archives will be saved per default */
    @define('REPORTIT_ARC_FD', REPORTIT_BASE_PATH . '/archive/');
    /* path where exports will be saved per default */
    @define('REPORTIT_EXP_FD', REPORTIT_BASE_PATH . '/exports/');
}
ikorzha commented 6 years ago

I am going to close this due to age. A lot has changed in plugin development since I opened this issue.