Cacti / plugin_reportit

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

Lastest Git, Report Viewing via reportit is not working. #60

Closed ikorzha closed 5 years ago

ikorzha commented 5 years ago

Receiving the following PHP errors in the log when attempting to view the report: Also attaching animated gif for reference:

scheduling-not-working

2018/10/03 17:08:01 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 847 CactiErrorHandler)(/lib/functions.php: 4585 cacti_debug_backtrace)

2018/10/03 17:08:01 - ERROR PHP WARNING in Plugin 'reportit': Invalid argument supplied for foreach() in file: /var/www/html/plugins/reportit/view.php on line: 847 2018/10/03 17:08:01 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 847 CactiErrorHandler)(/lib/functions.php: 4590 cacti_debug_backtrace) 2018/10/03 17:08:01 - ERROR PHP NOTICE in Plugin 'reportit': Undefined variable: ds_description in file: /var/www/html/plugins/reportit/view.php on line: 847 2018/10/03 17:08:01 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 775 CactiErrorHandler)(/lib/functions.php: 4585 cacti_debug_backtrace) 2018/10/03 17:08:01 - ERROR PHP WARNING in Plugin 'reportit': Invalid argument supplied for foreach() in file: /var/www/html/plugins/reportit/view.php on line: 775 2018/10/03 17:08:01 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 775 CactiErrorHandler)(/lib/functions.php: 4590 cacti_debug_backtrace) 2018/10/03 17:08:01 - ERROR PHP NOTICE in Plugin 'reportit': Undefined variable: ds_description in file: /var/www/html/plugins/reportit/view.php on line: 775 2018/10/03 17:08:01 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 761 CactiErrorHandler)(/lib/functions.php: 4585 cacti_debug_backtrace) 2018/10/03 17:08:01 - ERROR PHP WARNING in Plugin 'reportit': Invalid argument supplied for foreach() in file: /var/www/html/plugins/reportit/view.php on line: 761 2018/10/03 17:08:01 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 761 CactiErrorHandler)(/lib/functions.php: 4590 cacti_debug_backtrace) 2018/10/03 17:08:01 - ERROR PHP NOTICE in Plugin 'reportit': Undefined variable: ds_description in file: /var/www/html/plugins/reportit/view.php on line: 761

netniV commented 5 years ago

That should never happen as that suggests it can't find the data sources for your report. To check if this is true, try this:

diff --git a/view.php b/view.php
index 491f61a..9a23b75 100644
--- a/view.php
+++ b/view.php
@@ -742,6 +742,7 @@ function show_table_view($data, $rows, $total_rows) {
        }

        /* extract datasource description */
+       $ds_description = array();
        if ($count_rs > 0) {
                $ds_description = explode('|', $report_data['ds_description']);
                $columns += sizeof($ds_description)*$count_rs;
ikorzha commented 5 years ago

When I add "$ds_description = array();" line as you have suggested, When I click on report I now get the following errors:

2018/10/03 18:41:07 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 879 sizeof)(CactiErrorHandler)(/lib/functions.php: 4585 cacti_debug_backtrace)

2018/10/03 18:41:07 - ERROR PHP WARNING in Plugin 'reportit': sizeof(): Parameter must be an array or an object that implements Countable in file: /var/www/html/plugins/reportit/view.php on line: 879 2018/10/03 18:41:07 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/reportit/view.php: 47 show_report)(/plugins/reportit/view.php: 678 show_table_view)(/plugins/reportit/view.php: 879 CactiErrorHandler)(/lib/functions.php: 4590 cacti_debug_backtrace) 2018/10/03 18:41:07 - ERROR PHP NOTICE in Plugin 'reportit': Undefined variable: additional in file: /var/www/html/plugins/reportit/view.php on line: 879

However, there is simply no report available at all. I get this screen instead of report which is incorrect: image

netniV commented 5 years ago

OK, I've pushed another update through and this time it brings withit the "Overall" section and repairs the damage I did to the drop down filters too.

netniV commented 5 years ago

This is now in the main development code, please check and close if issue is resolved.

ikorzha commented 5 years ago

Issue is resolved, I realized what was happening. Here is my steps: I have exported a template out reportit, uninstalled the reportit, re-installed and re-enabled it. Imported a template in, and build a report on it. And report was resulting in errors above. What I didnt realize it, is that after I imported a template it "lost" data template checkmarks which was resulting in empty report. My apologizes for run around. I am closing this issue so we can concentrate on more important stuff.

netniV commented 5 years ago

Please raise the import issue as new issue 👍