From 5f1f44fb9ae8eed6a95bcc77a139950aa74cb529 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 23 Jul 2014 14:42:55 +0000 Subject: [PATCH] 2014-07-23 Miguel de Dios * include/functions_servers.php, include/functions_reporting.php: tiny fixes for the improve the support of postgreSQL databases. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ .../include/functions_reporting.php | 21 +++++++++++++++++-- pandora_console/include/functions_servers.php | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 3e4777a3f2..a62e7fc3ac 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2014-07-23 Miguel de Dios + + * include/functions_servers.php, include/functions_reporting.php: + tiny fixes for the improve the support of postgreSQL databases. + 2014-07-23 Miguel de Dios * operation/agentes/estado_generalagente.php: fixed the show the diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 48ac7b0675..20543987c8 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -907,6 +907,8 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi } function reporting_get_stats_servers($tiny = true) { + global $config; + $server_performance = servers_get_performance(); // Alerts table @@ -1020,8 +1022,23 @@ function reporting_get_stats_servers($tiny = true) { $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; - $system_events = db_get_value_sql('SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento'); - + + switch ($config["dbtype"]) { + case "mysql": + $system_events = db_get_value_sql( + 'SELECT SQL_NO_CACHE COUNT(id_evento) + FROM tevento'); + break; + case "postgresql": + case "oracle": + $system_events = db_get_value_sql( + 'SELECT COUNT(id_evento) + FROM tevento'); + break; + } + + + $tdata = array(); $tdata[0] = html_print_image('images/lightning_go.png', true, array('title' => __('Total events'), 'width' => '25px')); $tdata[1] = '' . format_numeric($system_events) . ''; diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 0b77499639..5b7679fca0 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -195,6 +195,8 @@ function servers_get_performance () { $interval_avgs_agents = array(); } + $interval_avgs = array(); + // Merge with the previous calculated array foreach($interval_avgs_agents as $iaagents) { if(!isset($interval_avgs[$iaagents['id_modulo']]['modules'])) {