Cacti / plugin_reportit

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

First report generated automaticaly on 8 reports is empty #83

Closed gmourani closed 5 years ago

gmourani commented 5 years ago

Hello,

I notice that on 8 reports generated every days automatically, the first one with ID1 is always empty! I've to manually run this report (ID1) for data to be available in it.

Looking at the log file, I can see the following errors but I don't know if there are related.

02/07/2019 00:00:01 - DBCALL ERROR: A DB Exec Failed!, Error:1054, SQL:'UPDATE plugin_reportit_reports SET state=?, last_state=? WHERE id=?' 02/06/2019 23:59:37 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'last_state' in 'where clause'

2/07/2019 14:02:10 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'last_state' in 'where clause' 02/07/2019 14:02:10 - DBCALL ERROR: A DB Exec Failed!, Error:1054, SQL:'UPDATE plugin_reportit_reports SET last_state = NOW(), state = -2 WHERE state = 1 AND last_state - NOW() < ?'

Regards,

netniV commented 5 years ago

That field should have been added when it did the 1.1.0 upgrade.

> show create table plugin_reportit_reports\G
CREATE TABLE `plugin_reportit_reports` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci 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) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `preset_timespan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `last_run` datetime DEFAULT NULL,
  `last_state` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `runtime` int(11) NOT NULL DEFAULT '0',
  `public` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `ds_description` varchar(5000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `rs_def` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `sp_def` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `sliding` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `present` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `scheduled` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `autorrdlist` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `auto_email` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email_subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email_body` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email_format` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `subhead` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `state` tinyint(1) NOT NULL DEFAULT '0',
  `graph_permission` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'on',
  `frequency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `autoarchive` mediumint(8) unsigned NOT NULL DEFAULT '1',
  `autoexport` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `autoexport_max_records` smallint(6) NOT NULL DEFAULT '0',
  `autoexport_no_formatting` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'on',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)
gmourani commented 5 years ago

It's there:

show create table plugin_reportit_reports\G 1. row Table: plugin_reportit_reports Create Table: CREATE TABLE plugin_reportit_reports ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', description varchar(255) COLLATE utf8_unicode_ci 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) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', preset_timespan varchar(255) COLLATE utf8_unicode_ci 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) COLLATE utf8_unicode_ci 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) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', rs_def varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', sp_def varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', sliding varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', present varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', scheduled varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', autorrdlist varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', auto_email varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', email_subject varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', email_body varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', email_format varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', subhead varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', state tinyint(1) NOT NULL DEFAULT '0', graph_permission varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'on', frequency varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', autoarchive mediumint(8) unsigned NOT NULL DEFAULT '1', autoexport varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', autoexport_max_records smallint(6) NOT NULL DEFAULT '0', autoexport_no_formatting varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'on', PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='general report definition parameters' 1 row in set (0.00 sec)

netniV commented 5 years ago

Yeah, you are missing a column. For some reason your upgrade hasn't applied the new one. Set the version of the plugin back in the plugin_config table so that it attempts the upgrades again.

gmourani commented 5 years ago

Which version back? Presently I read 1.0 in mysql even if I've 1.1.2 installed!

mysql> select * from plugin_config; +----+-----------+--------------------------+--------+-----------------+----------------------+---------+ | id | directory | name | status | author | webpage | version | +----+-----------+--------------------------+--------+-----------------+----------------------+---------+ | 13 | reportit | Reporting tool for Cacti | 1 | The Cacti Group | http://www.cacti.net | 1.0 | | 14 | thold | Thresholds | 1 | The Cacti Group | http://www.cacti.net | 1.0.4 | | 15 | monitor | Device Monitoring | 1 | The Cacti Group | http://www.cacti.net | 2.3.4 | +----+-----------+--------------------------+--------+-----------------+----------------------+---------+ 3 rows in set (0.00 sec)

netniV commented 5 years ago

Interesting, grab the latest release or develop branch as it should be later than 1.0

netniV commented 5 years ago

@gmourani have you had a chance to try upgrading?

gmourani commented 5 years ago

Sorry for the late. Yes, I've used latest Git version then, disable and enable the plugin again and now it is version 1.1.3 that is listed and no more error in the log, thanks.