diff --git a/pandora_console/extras/mr/32.sql b/pandora_console/extras/mr/32.sql index 3100d73092..56855a02d8 100644 --- a/pandora_console/extras/mr/32.sql +++ b/pandora_console/extras/mr/32.sql @@ -4,4 +4,8 @@ UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `wi (`type` = 10 && `image` IS NOT NULL && `image` != '' && `image` != 'none') || (`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0)); +ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0'; +ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0'; + + COMMIT; \ No newline at end of file diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 7407ba93fd..fa015300d6 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -153,6 +153,7 @@ $checks_in_ok_status = true; $unknown_checks = true; $agent_max_value = true; $agent_min_value = true; +$uncompressed_module = true; switch ($action) { case 'new': @@ -427,6 +428,7 @@ switch ($action) { ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $uncompressed_module = $item['uncompressed_module']; break; case 'historical_data': @@ -810,7 +812,6 @@ switch ($action) { break; } - $urlForm = $config['homeurl'].'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action='.$actionParameter.'&id_report='.$idReport; echo '
'; @@ -2792,6 +2793,23 @@ $class = 'databox filters'; ?> + + + + + + + + + + @@ -4524,6 +4542,7 @@ function chooseType() { $('#row_select_fields').hide(); $("#row_select_fields2").hide(); $("#row_select_fields3").hide(); + $("#row_uncompressed_module").hide(); // SLA list default state. $("#sla_list").hide(); @@ -4732,6 +4751,7 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_historical_db_check").hide(); + $("#row_uncompressed_module").show(); break; case 'historical_data': diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index aa89496ef7..501d4b9edd 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1908,6 +1908,11 @@ switch ($action) { $values['id_agent'] = get_parameter('group'); } + if ($values['type'] = 'sumatory') { + $values['uncompressed_module'] = get_parameter('uncompressed_module', 0); + } + + $values['header_definition'] = get_parameter('header'); $values['column_separator'] = get_parameter('field'); $values['line_separator'] = get_parameter('line'); @@ -2464,6 +2469,10 @@ switch ($action) { $values['id_agent'] = get_parameter('group'); } + if ($values['type'] = 'sumatory') { + $values['uncompressed_module'] = get_parameter('uncompressed_module', 0); + } + $values['header_definition'] = get_parameter('header'); $values['column_separator'] = get_parameter('field'); $values['line_separator'] = get_parameter('line'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3494eed389..4edd0ef642 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4903,7 +4903,8 @@ function reporting_value($report, $content, $type, $pdf=false) $value = reporting_get_agentmodule_data_sum( $content['id_agent_module'], $content['period'], - $report['datetime'] + $report['datetime'], + $content['uncompressed_module'] ); if (!$config['simple_module_value']) { $formated_value = $value; @@ -10725,17 +10726,19 @@ function reporting_get_agentmodule_data_min($id_agent_module, $period=0, $date=0 * @param int Agent module id to get the sumatory. * @param int Period of time to check (in seconds) * @param int Top date to check the values. Default current time. + * @param boolean Show uncompressed data from module * * @return float The sumatory of the module values in the interval. */ function reporting_get_agentmodule_data_sum( $id_agent_module, $period=0, - $date=0 + $date=0, + $uncompressed_module=true ) { global $config; - // Initialize variables + // Initialize variables. if (empty($date)) { $date = get_system_time(); } @@ -10757,21 +10760,24 @@ function reporting_get_agentmodule_data_sum( $id_module_type ); $module_interval = modules_get_interval($id_agent_module); - $uncompressed_module = is_module_uncompressed($module_name); + // Check if module must be compressed. + if (!$uncompressed_module) { + $uncompressed_module = is_module_uncompressed($module_name); + } // Wrong module type if (is_module_data_string($module_name)) { return 0; } - // Incremental modules are treated differently + // Incremental modules are treated differently. $module_inc = is_module_inc($module_name); - if ($uncompressed_module) { - // Get module data + if (!$uncompressed_module) { + // Get module data. $interval_data = db_get_all_rows_sql( ' - SELECT * FROM tagente_datos + SELECT * FROM tagente_datos WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' @@ -10792,7 +10798,7 @@ function reporting_get_agentmodule_data_sum( return false; } - // Set initial conditions + // Set initial conditions. $total = 0; $partial_total = 0; $count_sum = 0; @@ -10801,18 +10807,9 @@ function reporting_get_agentmodule_data_sum( $partial_total = 0; $count_sum = 0; - switch ($config['dbtype']) { - case 'mysql': - case 'postgresql': - // Do none - break; - - case 'oracle': - $data['datos'] = oracle_format_float_to_php($data['datos']); - break; - } - - if (!$module_inc) { + if (!$uncompressed_module) { + $total += $data['datos']; + } else if (!$module_inc) { foreach ($data['data'] as $val) { if (is_numeric($val['datos'])) { $partial_total += $val['datos']; @@ -10824,7 +10821,7 @@ function reporting_get_agentmodule_data_sum( continue; } - $total += ($partial_total / $count_sum); + $total += $partial_total; } else { $last = end($data['data']); $total += $last['datos']; diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index e8431ddeb2..0bba865711 100755 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -17,7 +17,6 @@ global $config; check_login(); enterprise_hook('open_meta_frame'); - $id_report = (int) get_parameter('id'); if (! $id_report) { diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index d1de66ab07..232b340b46 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1455,6 +1455,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `current_month` TINYINT(1) DEFAULT '1', `failover_mode` tinyint(1) DEFAULT '1', `failover_type` tinyint(1) DEFAULT '1', + `uncompressed_module` TINYINT DEFAULT '0', PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -2998,6 +2999,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `current_month` TINYINT(1) DEFAULT '1', `failover_mode` tinyint(1) DEFAULT '1', `failover_type` tinyint(1) DEFAULT '1', + `uncompressed_module` TINYINT DEFAULT '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8;