diff --git a/pandora_console/extras/mr/65.sql b/pandora_console/extras/mr/65.sql index cb8e3978dd..822d78a8c7 100644 --- a/pandora_console/extras/mr/65.sql +++ b/pandora_console/extras/mr/65.sql @@ -12,4 +12,6 @@ DELETE FROM tconfig WHERE token = 'refr'; ALTER TABLE `tusuario` ADD COLUMN `session_max_time_expire` INT NOT NULL DEFAULT 0 AFTER `auth_token_secret`; +ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`; + COMMIT; diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index b33aa1efe5..64fa992e76 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -321,6 +321,21 @@ switch ($action) { $full_text = empty($es['full_text']) ? 0 : $es['full_text']; break; + case 'event_report_log_table': + $period = $item['period']; + $period_range = $item['period_range']; + $description = $item['description']; + + $es = json_decode($item['external_source'], true); + $id_agents = $es['id_agents']; + $source = $es['source']; + $search = $es['search']; + $log_number = empty($es['log_number']) ? $log_number : $es['log_number']; + $full_text = empty($es['full_text']) ? 0 : $es['full_text']; + $show_graph = $item['show_graph']; + $group_by_agent = $item['group_by_agent']; + break; + case 'simple_graph': $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0; @@ -1025,6 +1040,7 @@ switch ($action) { case 'prediction_date': case 'simple_baseline_graph': case 'event_report_log': + case 'event_report_log_table': case 'increment': $label = (isset($style['label'])) ? $style['label'] : ''; break; @@ -1411,6 +1427,29 @@ $class = 'databox filters'; + + + + + + + + + option:selected").val() == undefined) { dialog_message('#message_no_group'); @@ -6385,6 +6430,7 @@ function chooseType() { $("#row_description").hide(); $("#row_label").hide(); $("#row_period").hide(); + $("#row_period_range").hide(); $("#row_agent").hide(); $("#row_module").hide(); $("#row_period").hide(); @@ -6559,7 +6605,24 @@ function chooseType() { loadLogAgents(); - break; + break; + + case 'event_report_log_table': + $("#log_help_tip").css("visibility", "visible"); + $("#row_description").show(); + $("#row_period").show(); + $("#row_period_range").show(); + $("#row_search").show(); + $("#row_log_number").show(); + $("#agents_row").show(); + $("#row_source").show(); + $("#row_historical_db_check").hide(); + $("#row_show_graph").show(); + $("#row_group_by_agent").show(); + + loadLogAgents(); + + break; case 'increment': $("#row_description").show(); @@ -7522,9 +7585,68 @@ function dialog_message(message_id) { } }); } - +function control_period_range() { + let value_period_range = $('#row_period_range #hidden-period_range').val(); + let current_value = $('#row_period #hidden-period').val(); + let min_range = (current_value/12); + if(min_range > value_period_range) { + $('#row_period_range div:nth-child(2) select option').removeAttr("selected"); + $('#row_period_range div:nth-child(1)').hide(); + $('#row_period_range div:nth-child(2)').show(); + setTimeout(() => { + if(min_range >= 2592000) { + $('#row_period_range input').val(Math.round((min_range/2592000) * 100) / 100); + $('#row_period_range div:nth-child(2) select option[value="2592000"]').attr("selected", "selected"); + $('#row_period_range div:nth-child(2) select').val(2592000); + $('#row_period_range #hidden-period_range').val(min_range); + return; + } + if(min_range >= 604800) { + $('#row_period_range input').val(Math.round((min_range/604800) * 100) / 100); + $('#row_period_range div:nth-child(2) select option[value="604800"]').attr("selected", "selected"); + $('#row_period_range div:nth-child(2) select').val(604800); + $('#row_period_range #hidden-period_range').val(min_range); + return; + } + if(min_range >= 86400) { + $('#row_period_range input').val(Math.round((min_range/86400) * 100) / 100); + $('#row_period_range div:nth-child(2) select option[value="86400"]').attr("selected", "selected"); + $('#row_period_range div:nth-child(2) select').val(86400); + $('#row_period_range #hidden-period_range').val(min_range); + return; + } + if(min_range >= 3600) { + $('#row_period_range input').val(Math.round((min_range/3600) * 100) / 100); + $('#row_period_range div:nth-child(2) select option[value="3600"]').attr("selected", "selected"); + $('#row_period_range div:nth-child(2) select').val(3600); + $('#row_period_range #hidden-period_range').val(min_range); + return; + } + if(min_range >= 60) { + $('#row_period_range input').val(Math.round((min_range/60) * 100) / 100); + $('#row_period_range div:nth-child(2) select option[value="60"]').attr("selected", "selected"); + $('#row_period_range div:nth-child(2) select option[value="60"]').val(60); + $('#row_period_range #hidden-period_range').val(min_range); + return; + } + }, 800); + } +} $(document).ready(function () { $('[id^=period], #combo_graph_options, #combo_sla_sort_options').next().css('z-index', 0); + + $('#row_period input').change(function(e){ + control_period_range(); + }); + $('#row_period select').change(function(e){ + control_period_range(); + }); + $('#row_period_range input').change(function(e){ + control_period_range(); + }); + $('#row_period_range select').change(function(e){ + control_period_range(); + }); }); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index edf4df6a40..f86e12c4e7 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1621,6 +1621,27 @@ switch ($action) { $good_format = true; break; + case 'event_report_log_table': + $agents_to_report = get_parameter('id_agents3'); + $source = get_parameter('source', ''); + $search = get_parameter('search', ''); + $full_text = (integer) get_parameter('full_text', 0); + $log_number = get_parameter('log_number', ''); + + $es['source'] = $source; + $es['id_agents'] = $agents_to_report; + $es['search'] = $search; + $es['full_text'] = $full_text; + $es['log_number'] = $log_number; + + $values['external_source'] = json_encode($es); + $values['period'] = get_parameter('period'); + $values['period_range'] = get_parameter('period_range'); + $values['show_graph'] = get_parameter('combo_graph_options'); + $values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent'); + $good_format = true; + break; + case 'prediction_date': $values['period'] = get_parameter('period1'); $values['top_n'] = get_parameter( @@ -2605,6 +2626,27 @@ switch ($action) { $good_format = true; break; + case 'event_report_log_table': + $agents_to_report = get_parameter('id_agents3'); + $source = get_parameter('source', ''); + $search = get_parameter('search', ''); + $full_text = (integer) get_parameter('full_text', 0); + $log_number = get_parameter('log_number', ''); + + $es['source'] = $source; + $es['id_agents'] = $agents_to_report; + $es['search'] = $search; + $es['full_text'] = $full_text; + $es['log_number'] = $log_number; + + $values['external_source'] = json_encode($es); + $values['period'] = get_parameter('period'); + $values['period_range'] = get_parameter('period_range'); + $values['show_graph'] = get_parameter('combo_graph_options'); + $values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent'); + $good_format = true; + break; + case 'agent_module': case 'agent_module_status': $agents_to_report_text = get_parameter('id_agents2-multiple-text'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c516ff2259..c01e44157a 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -412,6 +412,13 @@ function reporting_make_reporting_data( ); break; + case 'event_report_log_table': + $report['contents'][] = reporting_log_table( + $report, + $content + ); + break; + case 'increment': $report['contents'][] = reporting_increment( $report, diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 2f227e430c..91d8a9e5a5 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -259,6 +259,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) reporting_html_log($table, $item); break; + case 'event_report_log_table': + reporting_html_log_table($table, $item); + break; + case 'permissions_report': reporting_html_permissions($table, $item); break; diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 3be975fe2e..f13e935b6a 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -944,6 +944,11 @@ function reports_get_report_types($template=false, $not_editor=false) 'optgroup' => __('Log'), 'name' => __('Log report'), ]; + + $types['event_report_log_table'] = [ + 'optgroup' => __('Log'), + 'name' => __('Log report by period'), + ]; } if ($template === false) { diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index bc1715f97a..94765debbe 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1572,6 +1572,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `id_agent_module` BIGINT UNSIGNED NULL DEFAULT NULL, `type` VARCHAR(30) DEFAULT 'simple_graph', `period` INT NOT NULL DEFAULT 0, + `period_range` INT DEFAULT 0, `order` INT NOT NULL DEFAULT 0, `name` VARCHAR(300) NULL, `description` MEDIUMTEXT,