From 530a1e7a93260ea9a1c509647c822d4a63924c79 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 7 Nov 2016 16:54:18 +0100 Subject: [PATCH 1/3] New item to reports (Log)... (Init the feature) --- .../reporting_builder.item_editor.php | 11 ++++- .../include/functions_reporting.php | 40 +++++++++++++++++++ .../include/functions_reporting_html.php | 7 ++++ pandora_console/include/functions_reports.php | 3 ++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 85bea20ae5..86bcee943e 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -140,6 +140,7 @@ switch ($action) { case 'general': case 'network_interfaces_report': case 'availability': + case 'event_report_log': $get_data_editor = true; break; @@ -189,7 +190,9 @@ switch ($action) { $idAgentModule = $item['id_agent_module']; $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); break; - + case 'event_report_log': + $period = $item['period']; + $description = $item['description']; case 'simple_graph': $only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true; $percentil_95 = isset($style['percentil_95']) ? $style['percentil_95'] : 0; @@ -577,6 +580,7 @@ switch ($action) { case 'MTBF': case 'MTTR': case 'simple_baseline_graph': + case 'event_report_log': $label = (isset($style['label'])) ? $style['label'] : ''; break; default: @@ -2359,6 +2363,11 @@ function chooseType() { $("#row_filter_search").show(); break; + + case 'event_report_log': + $("#row_description").show(); + $("#row_period").show(); + break; case 'simple_graph': $("#row_time_compare_overlapped").show(); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 107ec6af36..2d67f7da39 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -147,6 +147,12 @@ function reporting_make_reporting_data($report = null, $id_report, $force_width_chart, $force_height_chart); break; + case 'event_report_log': + $report['contents'][] = + reporting_log( + $report, + $content); + break; case 'general': $report['contents'][] = reporting_general( @@ -463,6 +469,40 @@ function reporting_make_reporting_data($report = null, $id_report, return reporting_check_structure_report($report); } +function reporting_log ($report, $content) { + $return['type'] = 'event_report_log'; + + $period = $content['period']; + $date_limit = time() - $period; + if (empty($content['name'])) { + $content['name'] = __('Log report'); + } + + $return['title'] = $content['name']; + $return["description"] = $content["description"]; + $return["date"] = reporting_get_date_text($report, $content); + $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; + + $return['keys'] = array(__('Date'), __('Log')); + + // LEER FICHERO DE LOG Y SACAR DATOS + $log_data = array(); + $log_data = read_log_file_to_report($date_limit); + + $data = array(); + foreach ($result as $row) { + $data[] = array( + __('Date') => date ($config["date_format"], $row['utimestamp']), + __('Data') => $row['datos']); + } + + $return["data"] = $data; +} + +function read_log_file_to_report($date_limit) { + +} + function reporting_SLA($report, $content, $type = 'dinamic', $force_width_chart = null, $force_height_chart = null) { diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index bbe0b453ee..7051b6c18a 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -139,6 +139,9 @@ function reporting_html_print_report($report, $mini = false) { case 'availability': reporting_html_availability($table, $item); break; + case 'event_report_log': + reporting_html_log($table, $item); + break; case 'general': reporting_html_general($table, $item); break; @@ -290,6 +293,10 @@ function reporting_html_print_report($report, $mini = false) { } } +function reporting_html_log ($table, $item) { + html_debug('AAAA'); +} + function reporting_html_SLA($table, $item, $mini) { $style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']); $style = json_decode(io_safe_output($style), true); diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 698e4fc088..faefaab417 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -643,6 +643,9 @@ function reports_get_report_types ($template = false, $not_editor = false) { $types['netflow_summary'] = array('optgroup' => __('Netflow'), 'name' => __('Netflow summary table')); } + + $types['event_report_log'] = array('optgroup' => __('Log'), + 'name' => __('Log report')); return $types; } From 47443f7af3ae0b45658f38bf594e4623ed447371 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 8 Nov 2016 11:33:08 +0100 Subject: [PATCH 2/3] New item to reports (Log)... (Added some things to the new item) --- .../reporting_builder.item_editor.php | 1 + .../include/functions_reporting.php | 34 ------------------- .../include/functions_reporting_html.php | 5 --- pandora_console/include/functions_reports.php | 6 ++-- 4 files changed, 4 insertions(+), 42 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 86bcee943e..da6fcbceaa 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2367,6 +2367,7 @@ function chooseType() { case 'event_report_log': $("#row_description").show(); $("#row_period").show(); + $("#row_agent").show(); break; case 'simple_graph': diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 2d67f7da39..712f099d71 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -469,40 +469,6 @@ function reporting_make_reporting_data($report = null, $id_report, return reporting_check_structure_report($report); } -function reporting_log ($report, $content) { - $return['type'] = 'event_report_log'; - - $period = $content['period']; - $date_limit = time() - $period; - if (empty($content['name'])) { - $content['name'] = __('Log report'); - } - - $return['title'] = $content['name']; - $return["description"] = $content["description"]; - $return["date"] = reporting_get_date_text($report, $content); - $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; - - $return['keys'] = array(__('Date'), __('Log')); - - // LEER FICHERO DE LOG Y SACAR DATOS - $log_data = array(); - $log_data = read_log_file_to_report($date_limit); - - $data = array(); - foreach ($result as $row) { - $data[] = array( - __('Date') => date ($config["date_format"], $row['utimestamp']), - __('Data') => $row['datos']); - } - - $return["data"] = $data; -} - -function read_log_file_to_report($date_limit) { - -} - function reporting_SLA($report, $content, $type = 'dinamic', $force_width_chart = null, $force_height_chart = null) { diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 7051b6c18a..2b433a726c 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -101,7 +101,6 @@ function reporting_html_header(&$table, $mini, $title, $subtitle, } function reporting_html_print_report($report, $mini = false) { - foreach ($report['contents'] as $key => $item) { $table = new stdClass(); $table->size = array (); @@ -293,10 +292,6 @@ function reporting_html_print_report($report, $mini = false) { } } -function reporting_html_log ($table, $item) { - html_debug('AAAA'); -} - function reporting_html_SLA($table, $item, $mini) { $style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']); $style = json_decode(io_safe_output($style), true); diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index faefaab417..2f58c3ca51 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -625,8 +625,6 @@ function reports_get_report_types ($template = false, $not_editor = false) { } } - - if (!$template) { $types['agent_configuration'] = array('optgroup' => __('Configuration'), 'name' => __('Agent configuration')); @@ -644,8 +642,10 @@ function reports_get_report_types ($template = false, $not_editor = false) { 'name' => __('Netflow summary table')); } - $types['event_report_log'] = array('optgroup' => __('Log'), + if ($config['enterprise_installed']) { + $types['event_report_log'] = array('optgroup' => __('Log'), 'name' => __('Log report')); + } return $types; } From 3269473eee07557a3d0621403bdc34fe23c60bde Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 10 Nov 2016 11:59:23 +0100 Subject: [PATCH 3/3] New item to reports (Log)... (Added help tip to log item in reports) --- .../godmode/reporting/reporting_builder.item_editor.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index da6fcbceaa..3c49b85cbf 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -644,7 +644,12 @@ You can of course remove the warnings, that's why we include the source and do n echo ''; } ?> + ' . html_print_image ("images/tip.png", true, array('title' => $text)) . ''; + ?> + @@ -2332,6 +2337,7 @@ function chooseType() { $("#row_last_value").hide(); $("#row_filter_search").hide(); $("#row_percentil").hide(); + $("#log_help_tip").css("visibility", "hidden"); // SLA list default state $("#sla_list").hide(); @@ -2365,6 +2371,7 @@ function chooseType() { break; case 'event_report_log': + $("#log_help_tip").css("visibility", "visible"); $("#row_description").show(); $("#row_period").show(); $("#row_agent").show();