From 998d75e2cceb40e04f74188030383acb62c1faab Mon Sep 17 00:00:00 2001 From: Vanessa Gil Date: Mon, 22 Sep 2014 17:12:36 +0200 Subject: [PATCH] Fixed bug: bad precision in post_process parameter. Ticket #1326. --- .../extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql | 9 +++++++-- .../godmode/modules/manage_network_components.php | 8 +++++++- pandora_console/pandoradb.sql | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql index 3793bbbe3d..8608e47282 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql @@ -259,6 +259,11 @@ UPDATE FROM `network_component` SET `post_process`= 0.000000115740741 WHERE `id_ UPDATE FROM `network_component` SET `unit`= 'day' WHERE `id_nc`=53; -- --------------------------------------------------------------------- --- Table `network_component` +-- Table `tnetwork_component` -- --------------------------------------------------------------------- -ALTER TABLE `tnetwork_component` MODIFY COLUMN `post_process` DOUBLE(18,15) DEFAULT 0; +ALTER TABLE `tnetwork_component` MODIFY COLUMN `post_process` DOUBLE(24,15) DEFAULT 0; + +-- --------------------------------------------------------------------- +-- Table `tagente_modulo` +-- --------------------------------------------------------------------- +ALTER TABLE `tagente_modulo` MODIFY COLUMN `post_process` DOUBLE(24,15) DEFAULT 0; diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 3cafe9fcdf..c75b7a5812 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -85,7 +85,13 @@ $max_critical = (float) get_parameter ('max_critical'); $str_critical = (string) get_parameter ('str_critical'); $ff_event = (int) get_parameter ('ff_event'); $history_data = (bool) get_parameter ('history_data'); -$post_process = (float) get_parameter('post_process'); + +// Don't read as (float) because it lost it's decimals when put into MySQL +// where are very big and PHP uses scientific notation, p.e: +// 1.23E-10 is 0.000000000123 + +$post_process = (string) get_parameter ('post_process', 0.0); + $unit = (string) get_parameter('unit'); $id = (int) get_parameter ('id'); $wizard_level = get_parameter ('wizard_level', 'nowizard'); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 17d1547707..63ab1e88f2 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -203,7 +203,7 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` ( `plugin_pass` text, `plugin_parameter` text, `id_plugin` int(10) default '0', - `post_process` double(18,15) default 0, + `post_process` double(24,15) default 0, `prediction_module` bigint(14) default '0', `max_timeout` int(4) unsigned default '0', `max_retries` int(4) unsigned default '0', @@ -707,7 +707,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` ( `custom_string_3` text, `custom_integer_1` int(10) default 0, `custom_integer_2` int(10) default 0, - `post_process` double(18,15) default 0, + `post_process` double(24,15) default 0, `unit` text, `wizard_level` enum('basic','advanced','nowizard') default 'nowizard', `macros` text,