Cacti / plugin_reportit

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

Plugin shut down during report running #19

Closed chenbangkuo closed 6 years ago

chenbangkuo commented 6 years ago

Cacti LAMP :: cacti-1.1.35 mysql apache2

Hi, after the Templates report configuration, Reports did run smoothly also generating. but after i tried to filter the traffic , Plugin auto shut down and show error 500. since then reconfigure the reports show the same error.
if there's a guide through this problem well be glad to know , thanks Taiwan NOC

netniV commented 6 years ago

Bit late, but do you have any error logs that you can share from the Logs tab within Cacti?

SergejLT commented 6 years ago

18 same problem

chenbangkuo commented 6 years ago

Hi, sorry for the late reply here's the error log after runs the reports .

2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: data_template_alias in file: /var/www/html/cacti/plugins/reportit/lib/funct_shared.php on line: 145 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 453 get_prepared_archive_data)(/plugins/reportit/lib/funct_shared.php: 145 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - DBCALL ERROR: SQL Assoc Failed!, Error:1146, SQL:'SELECT * FROM reportit_tmp__0 AS a ' 2018/04/20 02:12:28 - DBCALL ERROR: SQL Assoc Failed!, Error: Table 'cacti.reportit_tmp__0' doesn't exist 2018/04/20 02:12:28 - CMDPHP SQL Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 453 get_prepared_archive_data)(/plugins/reportit/lib/funct_shared.php: 188 db_fetch_assoc)(/lib/database.php: 360 db_fetch_assoc_prepared)(/lib/database.php: 401 cacti_debug_backtrace) 2018/04/20 02:12:28 - CMDPHP SQL Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 464 db_fetch_cell)(/lib/database.php: 233 db_fetch_cell_prepared)(/lib/database.php: 280 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: description in file: /var/www/html/cacti/plugins/reportit/view.php on line: 470 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 470 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: description in file: /var/www/html/cacti/plugins/reportit/view.php on line: 474 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 474 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: runtime in file: /var/www/html/cacti/plugins/reportit/view.php on line: 475 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 475 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: owner in file: /var/www/html/cacti/plugins/reportit/view.php on line: 477 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 477 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: sliding in file: /var/www/html/cacti/plugins/reportit/view.php on line: 478 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 478 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: last_run in file: /var/www/html/cacti/plugins/reportit/view.php on line: 480 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 480 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: scheduled in file: /var/www/html/cacti/plugins/reportit/view.php on line: 481 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 481 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: start_date in file: /var/www/html/cacti/plugins/reportit/view.php on line: 483 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 483 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: end_date in file: /var/www/html/cacti/plugins/reportit/view.php on line: 483 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 483 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: autorrdlist in file: /var/www/html/cacti/plugins/reportit/view.php on line: 484 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 484 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: rs_def in file: /var/www/html/cacti/plugins/reportit/view.php on line: 488 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 488 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined offset: 1 in file: /var/www/html/cacti/plugins/reportit/view.php on line: 488 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 488 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: sp_def in file: /var/www/html/cacti/plugins/reportit/view.php on line: 513 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 513 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP NOTICE in Plugin 'reportit': Undefined offset: 1 in file: /var/www/html/cacti/plugins/reportit/view.php on line: 513 2018/04/20 02:12:28 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 513 CactiErrorHandler)(/lib/functions.php: 4634 cacti_debug_backtrace) 2018/04/20 02:12:28 - ERROR PHP ERROR in Plugin 'reportit': Uncaught Error: Call to undefined function html_graph_start_box() in /var/www/html/cacti/plugins/reportit/view.php:727

netniV commented 6 years ago

So there appears to be an issue with the way get_prepared_archive_data() is retrieving the cached report. Either the ID does not match or the table structure is not as expected. So, easy part first, can you give me the table structure from mysql by doing the following:

SHOW CREATE TABLE `plugin_reportit_cache_reports`\G

and also the following:

SELECT COUNT(DISTINCT cache_id) FROM `plugin_reportit_cache_reports`;
chenbangkuo commented 6 years ago

Hi , netniV here's the results bellow

mysql> SHOW CREATE TABLE _`plugin_reportit_cache_reports`\G_
*************************** 1. row ***************************
       Table: plugin_reportit_cache_reports
Create Table: CREATE TABLE `plugin_reportit_cache_reports` (
  `cache_id` varchar(30) NOT NULL DEFAULT '',
  `id` int(11) NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL DEFAULT '',
  `description` varchar(255) NOT NULL DEFAULT '',
  `user_id` int(11) NOT NULL DEFAULT '0',
  `template_id` int(11) NOT NULL DEFAULT '0',
  `host_template_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `data_source_filter` varchar(255) NOT NULL DEFAULT '',
  `preset_timespan` varchar(255) NOT NULL DEFAULT '',
  `last_run` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `runtime` int(11) NOT NULL DEFAULT '0',
  `public` varchar(2) NOT NULL DEFAULT '',
  `start_date` date NOT NULL DEFAULT '0000-00-00',
  `end_date` date NOT NULL DEFAULT '0000-00-00',
  `ds_description` varchar(5000) NOT NULL DEFAULT '',
  `rs_def` varchar(255) NOT NULL DEFAULT '',
  `sp_def` varchar(255) NOT NULL DEFAULT '',
  `sliding` varchar(2) NOT NULL DEFAULT '',
  `present` varchar(2) NOT NULL DEFAULT '',
  `scheduled` varchar(2) NOT NULL DEFAULT '',
  `autorrdlist` varchar(2) NOT NULL DEFAULT '',
  `auto_email` varchar(2) NOT NULL DEFAULT '',
  `email_subject` varchar(255) NOT NULL DEFAULT '',
  `email_body` varchar(1000) NOT NULL DEFAULT '',
  `email_format` varchar(255) NOT NULL DEFAULT '',
  `subhead` varchar(255) NOT NULL DEFAULT '',
  `state` tinyint(1) NOT NULL DEFAULT '0',
  `graph_permission` varchar(2) NOT NULL DEFAULT 'on',
  `frequency` varchar(255) NOT NULL DEFAULT '',
  `autoarchive` mediumint(8) unsigned NOT NULL DEFAULT '1',
  `autoexport` varchar(255) NOT NULL DEFAULT '',
  `autoexport_max_records` smallint(6) NOT NULL DEFAULT '0',
  `autoexport_no_formatting` varchar(2) NOT NULL DEFAULT 'on',
  PRIMARY KEY (`cache_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='report definition parameters of archived reports read in temporarily'
1 row in set (0.00 sec)
mysql> SELECT COUNT(DISTINCT cache_id) FROM `plugin_reportit_cache_reports`;
+--------------------------+
| COUNT(DISTINCT cache_id) |
+--------------------------+
|                        0 |
+--------------------------+
1 row in set (0.00 sec)

Thanks 😄

netniV commented 6 years ago

Yeah, it's as I suspected, there is nothing in that table, yet it's trying to retrieve something and doesn't check that it's got the data it needs. There is also a missing function html_graph_start_box() and i'can't seem to find that in the source anywhere. So I'm not sure how it ever worked. I'll have to investigate further.

Kallyx commented 6 years ago

Hi there,

Same issue I have encountered also when I run the reportit SQL:MariaDB-server-10.1.22-1.el7;

2018/05/23 12:09:16 - DBCALL ERROR: SQL Assoc Failed!, Error: Table 'cacti.reportit_tmp__0' doesn't exist 2018/05/23 12:09:16 - DBCALL ERROR: SQL Assoc Failed!, Error:1146, SQL:'SELECT * FROM reportit_tmp__0 AS a ' 2018/05/23 12:09:16 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 43 show_report)(/plugins/reportit/view.php: 453 get_prepared_archive_data)(/plugins/reportit/lib/funct_shared.php: 145 CactiErrorHandler)(/lib/functions.php: 4408 cacti_debug_backtrace) 2018/05/23 12:09:16 - ERROR PHP NOTICE in Plugin 'reportit': Undefined index: data_template_alias in file: /var/www/html/cacti/plugins/reportit/lib/funct_shared.php on line: 145

MariaDB [cacti]> SELECT COUNT(DISTINCT cache_id) FROM plugin_reportit_cache_reports; +--------------------------+ | COUNT(DISTINCT cache_id) | +--------------------------+ | 0 | +--------------------------+ 1 row in set (0.00 sec)

===================================================================

MariaDB [cacti]> SHOW CREATE TABLE plugin_reportit_cache_reports; +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | plugin_reportit_cache_reports | CREATE TABLE plugin_reportit_cache_reports ( cache_id varchar(30) NOT NULL DEFAULT '', id int(11) NOT NULL DEFAULT '0', name varchar(255) NOT NULL DEFAULT '', description varchar(255) NOT NULL DEFAULT '', user_id int(11) NOT NULL DEFAULT '0', template_id int(11) NOT NULL DEFAULT '0', host_template_id mediumint(8) unsigned NOT NULL DEFAULT '0', data_source_filter varchar(255) NOT NULL DEFAULT '', preset_timespan varchar(255) NOT NULL DEFAULT '', last_run datetime NOT NULL DEFAULT '0000-00-00 00:00:00', runtime int(11) NOT NULL DEFAULT '0', public varchar(2) NOT NULL DEFAULT '', start_date date NOT NULL DEFAULT '0000-00-00', end_date date NOT NULL DEFAULT '0000-00-00', ds_description varchar(5000) NOT NULL DEFAULT '', rs_def varchar(255) NOT NULL DEFAULT '', sp_def varchar(255) NOT NULL DEFAULT '', sliding varchar(2) NOT NULL DEFAULT '', present varchar(2) NOT NULL DEFAULT '', scheduled varchar(2) NOT NULL DEFAULT '', autorrdlist varchar(2) NOT NULL DEFAULT '', auto_email varchar(2) NOT NULL DEFAULT '', email_subject varchar(255) NOT NULL DEFAULT '', email_body varchar(1000) NOT NULL DEFAULT '', email_format varchar(255) NOT NULL DEFAULT '', subhead varchar(255) NOT NULL DEFAULT '', state tinyint(1) NOT NULL DEFAULT '0', graph_permission varchar(2) NOT NULL DEFAULT 'on', frequency varchar(255) NOT NULL DEFAULT '', autoarchive mediumint(8) unsigned NOT NULL DEFAULT '1', autoexport varchar(255) NOT NULL DEFAULT '', autoexport_max_records smallint(6) NOT NULL DEFAULT '0', autoexport_no_formatting varchar(2) NOT NULL DEFAULT 'on', PRIMARY KEY (cache_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='report definition parameters of archived reports read in temporarily' |

Kallyx commented 6 years ago

MariaDB [cacti]> show global variables like '%mode%'; +--------------------------+--------------------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------------------+ | gtid_strict_mode | OFF | | innodb_autoinc_lock_mode | 1 | | innodb_strict_mode | OFF | | old_mode | | | slave_ddl_exec_mode | IDEMPOTENT | | slave_exec_mode | STRICT | | slave_parallel_mode | conservative | | sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | | wsrep_gtid_mode | OFF | +--------------------------+--------------------------------------------+ 9 rows in set (0.00 sec)

Kallyx commented 6 years ago

20

browniebraun commented 6 years ago

Similar to #20, fixed