Cacti / plugin_reportit

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

reportit reports are not running #86

Open vishnubraj opened 4 years ago

vishnubraj commented 4 years ago

i running develop branch of reportit and latest version of cacti.. not able to run the reports from command line. I am getting the below errors continuously..

PHP Notice: Undefined offset: 12062 in /var/www/cacti/plugins/reportit/lib/funct_runtime.php on line 457 PHP 1. {main}() /var/www/cacti/plugins/reportit/runtime.php:0 PHP 2. run() /var/www/cacti/plugins/reportit/runtime.php:99 PHP 3. runtime() /var/www/cacti/plugins/reportit/runtime.php:164 PHP 4. get_prepared_data() /var/www/cacti/plugins/reportit/runtime.php:519

vishnubraj commented 4 years ago

i fixed the above error by updating the code as below..

diff --git a/lib/funct_runtime.php b/lib/funct_runtime.php
index c9dd3b7..a0a5ba7 100644
--- a/lib/funct_runtime.php
+++ b/lib/funct_runtime.php
@@ -454,7 +454,8 @@ function get_prepared_data(&$rrd_data, &$rrd_ad_data, $rrd_ds_cnt, $ds_type, $co
                        for ($k = 1; $k < $steps; $k++) {
                                $number = $index + $k * $rrd_ds_cnt;

-                               $data[$i][$number]  = $rrd_data[$number];
+                               //$data[$i][$number]  = $rrd_data[$number];
+                               $data[$i][$number]  = isset($rrd_data[$number]) ? $rrd_data[$number] : null;
                                $multi[$i][$number] = 1;
                        }

but i started getting below errors.. Please check..

PHP Warning:  A non-numeric value encountered in /var/www/cacti/plugins/reportit/lib/funct_runtime.php on line 252
PHP Stack trace:
PHP   1. {main}() /var/www/cacti/plugins/reportit/runtime.php:0
PHP   2. run() /var/www/cacti/plugins/reportit/runtime.php:99
PHP   3. runtime() /var/www/cacti/plugins/reportit/runtime.php:164
PHP   4. get_type_of_request() /var/www/cacti/plugins/reportit/runtime.php:493
PHP Warning:  A non-numeric value encountered in /var/www/cacti/plugins/reportit/runtime.php on line 484
PHP Stack trace:
PHP   1. {main}() /var/www/cacti/plugins/reportit/runtime.php:0
PHP   2. run() /var/www/cacti/plugins/reportit/runtime.php:99
PHP   3. runtime() /var/www/cacti/plugins/reportit/runtime.php:164

also what is the php version recommended.. i am running 7.1.32

netniV commented 4 years ago

PHP 5.4+ should work. You are likely getting the above errors as you've put null into a field that expected to be a number.

JaseMac commented 4 years ago

I had the same problem. I was running Cacti 0.8.8a with Reportit 0.7.5a. I created a new Cacti server running 1.2.8 with Reportit 1.1.3 (the latest I could download). After the upgrade I was able to get all my normal Cacti functions working fine except for the reports from Reportit. I was receiving the following errors in my error log:

2020/02/04 09:45:46 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())

2020/02/04 09:45:46 - ERROR PHP ERROR: Maximum execution time of 300 seconds exceeded in file: C:\Apache24\htdocs\cacti\plugins\reportit\lib\funct_runtime.php on line: 455 2020/02/04 09:45:46 - CMDPHP PHP ERROR NOTICE Backtrace: (C:\Apache24\htdocs\cacti\plugins\reportit\run.php[55]:calculation(), C:\Apache24\htdocs\cacti\plugins\reportit\run.php[78]:runtime(), C:\Apache24\htdocs\cacti\plugins\reportit\runtime.php[519]:get_prepared_data(), C:\Apache24\htdocs\cacti\plugins\reportit\lib\funct_runtime.php[457]:CactiErrorHandler()) 2020/02/04 09:45:46 - ERROR PHP NOTICE: Undefined offset: 106046 in file: C:\Apache24\htdocs\cacti\plugins\reportit\lib\funct_runtime.php on line: 457 2020/02/04 09:45:46 - CMDPHP PHP ERROR NOTICE Backtrace: (C:\Apache24\htdocs\cacti\plugins\reportit\run.php[55]:calculation(), C:\Apache24\htdocs\cacti\plugins\reportit\run.php[78]:runtime(), C:\Apache24\htdocs\cacti\plugins\reportit\runtime.php[519]:get_prepared_data(), C:\Apache24\htdocs\cacti\plugins\reportit\lib\funct_runtime.php[457]:CactiErrorHandler()) 2020/02/04 09:45:46 - ERROR PHP NOTICE: Undefined offset: 106044 in file: C:\Apache24\htdocs\cacti\plugins\reportit\lib\funct_runtime.php on line: 457 2020/02/04 09:45:46 - CMDPHP PHP ERROR NOTICE Backtrace: (C:\Apache24\htdocs\cacti\plugins\reportit\run.php[55]:calculation(), C:\Apache24\htdocs\cacti\plugins\reportit\run.php[78]:runtime(), C:\Apache24\htdocs\cacti\plugins\reportit\runtime.php[519]:get_prepared_data(), C:\Apache24\htdocs\cacti\plugins\reportit\lib\funct_runtime.php[457]:CactiErrorHandler())

I applied the code snipit that vishnubraj suggested and it resolved my issue! Thank you so much!