From fad6a1e52d3bd0cfc5f6394700efd2fd038d38de Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 15 Jun 2015 17:43:02 +0200 Subject: [PATCH] =?UTF-8?q?Fixes=20for=20the=20Oracl=E2=82=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reporting_builder.list_items.php | 2 +- .../include/functions_reporting.php | 127 +++++++++++++++++- 2 files changed, 127 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index cfa6cebc23..110b2e83e1 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -187,7 +187,7 @@ if (!defined("METACONSOLE")) { echo ''; } else { - $table = null; + $table = new stdClass(); $table->width = '96%'; $table->class = "databox_filters"; $table->cellpadding = 0; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index ccf8816771..5b6f504026 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -5647,7 +5647,30 @@ function reporting_get_agentmodule_data_average ($id_agent_module, $period=0, $d $period = $date - $previous_data['utimestamp']; } } + + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $previous_data['datos'] = + oracle_format_float_to_php($previous_data['datos']); + break; + } + foreach ($interval_data as $data) { + 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 += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']); $previous_data = $data; @@ -5722,7 +5745,8 @@ function reporting_get_agentmodule_mttr ($id_agent_module, $period = 0, $date = if ($interval_data === false) $interval_data = array (); // Get previous data - $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data( + $id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); @@ -5750,6 +5774,18 @@ function reporting_get_agentmodule_mttr ($id_agent_module, $period = 0, $date = $critical_period = 0; $first_data = array_shift ($interval_data); $previous_utimestamp = $first_data['utimestamp']; + + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $first_data['datos'] = + oracle_format_float_to_php($first_data['datos']); + break; + } + if ((($critical_max > $critical_min AND ($first_data['datos'] > $critical_max OR $first_data['datos'] < $critical_min))) OR ($critical_max <= $critical_min AND $first_data['datos'] < $critical_min)) { $previous_status = 1; @@ -5761,6 +5797,17 @@ function reporting_get_agentmodule_mttr ($id_agent_module, $period = 0, $date = } foreach ($interval_data as $data) { + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $data['datos'] = + oracle_format_float_to_php($data['datos']); + break; + } + // Previous status was critical if ($previous_status == 1) { $critical_period += $data['utimestamp'] - $previous_utimestamp; @@ -5863,6 +5910,18 @@ function reporting_get_agentmodule_mtbf ($id_agent_module, $period = 0, $date = $critical_period = 0; $first_data = array_shift ($interval_data); $previous_utimestamp = $first_data['utimestamp']; + + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $first_data['datos'] = + oracle_format_float_to_php($first_data['datos']); + break; + } + if ((($critical_max > $critical_min AND ($first_data['datos'] > $critical_max OR $first_data['datos'] < $critical_min))) OR ($critical_max <= $critical_min AND $first_data['datos'] < $critical_min)) { $previous_status = 1; @@ -5879,6 +5938,17 @@ function reporting_get_agentmodule_mtbf ($id_agent_module, $period = 0, $date = $critical_period += $data['utimestamp'] - $previous_utimestamp; } + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $data['datos'] = + oracle_format_float_to_php($data['datos']); + break; + } + // Re-calculate previous status for the next data if ((($critical_max > $critical_min AND ($data['datos'] > $critical_max OR $data['datos'] < $critical_min))) OR ($critical_max <= $critical_min AND $data['datos'] < $critical_min)) { @@ -6927,7 +6997,30 @@ function reporting_get_agentmodule_data_max ($id_agent_module, $period=0, $date } } + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $max = oracle_format_float_to_php($max); + break; + } + + + foreach ($interval_data as $data) { + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $data['datos'] = + oracle_format_float_to_php($data['datos']); + break; + } + if ($data['datos'] > $max) { $max = $data['datos']; } @@ -7003,7 +7096,28 @@ function reporting_get_agentmodule_data_min ($id_agent_module, $period=0, $date // Set initial conditions $min = $interval_data[0]['datos']; + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $min = oracle_format_float_to_php($min); + break; + } + foreach ($interval_data as $data) { + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + // Do none + break; + case "oracle": + $data['datos'] = + oracle_format_float_to_php($data['datos']); + break; + } + if ($data['datos'] < $min) { $min = $data['datos']; } @@ -7098,6 +7212,17 @@ function reporting_get_agentmodule_data_sum ($id_agent_module, } foreach ($interval_data as $data) { + 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']; }