From 41d8afaeea8b1b379965e851ac9f3631e2e3c7bf Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Fri, 12 Jul 2019 11:32:56 +0200 Subject: [PATCH 1/7] added summation report uncompressed module cehckbox --- .../reporting_builder.item_editor.php | 20 +++++++++++++++++++ .../godmode/reporting/reporting_builder.php | 9 +++++++++ .../include/functions_reporting.php | 12 ++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index ff8ca88e40..9244fd8c27 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -427,6 +427,7 @@ switch ($action) { ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $uncompressed_module = $item['uncompressed_module']; break; case 'historical_data': @@ -2769,6 +2770,23 @@ $class = 'databox filters'; ?> + + + + + + + + + + @@ -4498,6 +4516,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(); @@ -4706,6 +4725,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 1e552b112a..43f5c1510b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1862,6 +1862,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'); @@ -2400,6 +2405,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 97766305a2..5861849f1e 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -10654,7 +10654,8 @@ function reporting_get_agentmodule_data_min($id_agent_module, $period=0, $date=0 function reporting_get_agentmodule_data_sum( $id_agent_module, $period=0, - $date=0 + $date=0, + $uncompressed_module=true ) { global $config; @@ -10680,7 +10681,10 @@ 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)) { @@ -10735,7 +10739,9 @@ function reporting_get_agentmodule_data_sum( 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']; From ef9502a552372051f72ce07851503e297e88000e Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 15 Jul 2019 11:56:57 +0200 Subject: [PATCH 2/7] Fixed errors on sum report uncompressed checkbox --- .../godmode/reporting/reporting_builder.item_editor.php | 4 ++-- pandora_console/include/functions_db.php | 1 + pandora_console/include/functions_reporting.php | 8 +++++--- pandora_console/operation/reporting/reporting_viewer.php | 2 +- pandora_console/pandoradb.sql | 1 + 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 9244fd8c27..52a4852d2d 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': @@ -811,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 '
'; @@ -2782,7 +2782,7 @@ $class = 'databox filters'; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 3efbf59628..6bec03c9c2 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -520,6 +520,7 @@ function db_get_sql($sql, $field=0, $search_history_db=false) * Get all the result rows using an SQL statement. * * @param string SQL statement to execute. + global $config; * @param bool If want to search in history database also * @param bool If want to use cache (true by default) * diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 5861849f1e..9382cfb938 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4879,7 +4879,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; @@ -10648,6 +10649,7 @@ 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. */ @@ -10694,7 +10696,7 @@ function reporting_get_agentmodule_data_sum( // Incremental modules are treated differently $module_inc = is_module_inc($module_name); - if ($uncompressed_module) { + if (!$uncompressed_module) { // Get module data $interval_data = db_get_all_rows_sql( ' @@ -10739,7 +10741,7 @@ function reporting_get_agentmodule_data_sum( break; } - if ($uncompressed_module) { + if (!$uncompressed_module) { $total += $data['datos']; } else if (!$module_inc) { foreach ($data['data'] as $val) { diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index e8431ddeb2..96431e9791 100755 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -17,7 +17,7 @@ global $config; check_login(); enterprise_hook('open_meta_frame'); - +hd($_POST); $id_report = (int) get_parameter('id'); if (! $id_report) { diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 95d6caadfd..9f9020990e 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 '1', PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE From 53c239f55833c05f5544ce0f30f00a25bd135f5c Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 17 Jul 2019 10:34:56 +0200 Subject: [PATCH 3/7] fixed minor errors --- pandora_console/include/functions_db.php | 1 - pandora_console/operation/reporting/reporting_viewer.php | 1 - 2 files changed, 2 deletions(-) diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 6bec03c9c2..3efbf59628 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -520,7 +520,6 @@ function db_get_sql($sql, $field=0, $search_history_db=false) * Get all the result rows using an SQL statement. * * @param string SQL statement to execute. - global $config; * @param bool If want to search in history database also * @param bool If want to use cache (true by default) * diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 96431e9791..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'); -hd($_POST); $id_report = (int) get_parameter('id'); if (! $id_report) { From e89efea0223cd901cd2a8c961dbf4980d8d25c8d Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 16 Sep 2019 11:18:01 +0200 Subject: [PATCH 4/7] Added column 'uncompressed_module' to 'treport_content' --- pandora_console/extras/mr/32.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/extras/mr/32.sql b/pandora_console/extras/mr/32.sql index 3100d73092..5d2e0904d8 100644 --- a/pandora_console/extras/mr/32.sql +++ b/pandora_console/extras/mr/32.sql @@ -4,4 +4,6 @@ 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 '1'; + COMMIT; \ No newline at end of file From e409b33c6ce9fe22037b6223f22c14b73f790753 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Tue, 17 Sep 2019 12:32:07 +0200 Subject: [PATCH 5/7] Added changes to treport_content_template to db --- pandora_console/extras/mr/32.sql | 2 ++ pandora_console/pandoradb.sql | 1 + 2 files changed, 3 insertions(+) diff --git a/pandora_console/extras/mr/32.sql b/pandora_console/extras/mr/32.sql index 5d2e0904d8..ce78011739 100644 --- a/pandora_console/extras/mr/32.sql +++ b/pandora_console/extras/mr/32.sql @@ -5,5 +5,7 @@ UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `wi (`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0)); ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '1'; + COMMIT; \ No newline at end of file diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 13aac100e9..e6d6e4d625 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2999,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 '1', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 43af2269eedf04ece9d8efb3fd38c5132858c2bd Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 18 Sep 2019 11:51:01 +0200 Subject: [PATCH 6/7] Fixed default values uncompress data --- pandora_console/extras/mr/32.sql | 4 ++-- pandora_console/pandoradb.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/extras/mr/32.sql b/pandora_console/extras/mr/32.sql index ce78011739..56855a02d8 100644 --- a/pandora_console/extras/mr/32.sql +++ b/pandora_console/extras/mr/32.sql @@ -4,8 +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 '1'; -ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '1'; +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/pandoradb.sql b/pandora_console/pandoradb.sql index e6d6e4d625..232b340b46 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1455,7 +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 '1', + `uncompressed_module` TINYINT DEFAULT '0', PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -2999,7 +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 '1', + `uncompressed_module` TINYINT DEFAULT '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 056bbb7348d79d83f0b683d37ba9d1ca76d56176 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Wed, 18 Sep 2019 13:16:05 +0200 Subject: [PATCH 7/7] fixed minor error --- .../include/functions_reporting.php | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index b27a2ff9f4..4edd0ef642 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -10738,7 +10738,7 @@ function reporting_get_agentmodule_data_sum( ) { global $config; - // Initialize variables + // Initialize variables. if (empty($date)) { $date = get_system_time(); } @@ -10760,7 +10760,7 @@ function reporting_get_agentmodule_data_sum( $id_module_type ); $module_interval = modules_get_interval($id_agent_module); - // Check if module must be compressed + // Check if module must be compressed. if (!$uncompressed_module) { $uncompressed_module = is_module_uncompressed($module_name); } @@ -10770,14 +10770,14 @@ function reporting_get_agentmodule_data_sum( 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 + // 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.' @@ -10798,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; @@ -10807,17 +10807,6 @@ 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 (!$uncompressed_module) { $total += $data['datos']; } else if (!$module_inc) { @@ -10832,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'];