diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e8eae86708..f6ac654626 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-03-01 Sergio Martin + + * include/javascript/jquery.pandora.js + include/functions_servers.php + operation/events/event_statistics.php + general/logon_ok.php + godmode/admin_access_logs.php: Fix little bugs and + the server performance counts + 2013-02-28 Sergio Martin * include/javascript/pandora_events.js diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 3c7013c9fb..5a2184cd5e 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -87,7 +87,6 @@ echo '
' $table->width = '100%'; //Don't specify px $table->data = array (); $table->size = array (); - $table->style[2] = 'text-align:center;'; $table->size[1] = '150px'; $table->size[2] = '130px'; $table->size[4] = '200px'; @@ -144,7 +143,7 @@ echo '
' $data[0] = '' . $session_id_usuario . ''; $data[1] = ui_print_session_action_icon ($session['accion'], true); $data[1] .= $session['accion']; - $data[2] = human_time_comparation($session['utimestamp']) . ui_print_help_tip($session['fecha'], true); + $data[2] = ui_print_help_tip($session['fecha'], true) . human_time_comparation($session['utimestamp']); $data[3] = $session_ip_origen; $data[4] = io_safe_output ($session['descripcion']); diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index cddf01da49..58001b99e7 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -242,8 +242,9 @@ foreach ($result as $row) { $data[0] = $row["id_usuario"]; break; } - $data[1] = $row["accion"]; - $data[2] = $row["fecha"]; + $data[1] = ui_print_session_action_icon ($row['accion'], true); + $data[1] .= $row["accion"]; + $data[2] = ui_print_help_tip($row['fecha'], true) . human_time_comparation($row['utimestamp']); switch ($config['dbtype']) { case "mysql": case "postgresql": diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index a02fe36871..44d13a2e85 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -83,7 +83,7 @@ function servers_get_performance () { $counts = db_get_all_rows_sql ("SELECT tagente_modulo.id_modulo, COUNT(tagente_modulo.id_agente_modulo) modules FROM tagente_modulo, tagente_estado, tagente WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND tagente_modulo.disabled = 0 AND module_interval > 0 AND utimestamp > 0 AND delete_pending = 0 + AND tagente_modulo.disabled = 0 AND delete_pending = 0 AND (utimestamp > 0 OR (id_tipo_modulo = 100 OR (id_tipo_modulo > 21 AND id_tipo_modulo < 23))) AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente GROUP BY tagente_modulo.id_modulo"); if(empty($counts)) { @@ -163,15 +163,51 @@ function servers_get_performance () { $data["total_modules"] += $c['modules']; } } - - $interval_avgs = db_get_all_rows_sql ("SELECT tagente_modulo.id_modulo, AVG(tagente_modulo.module_interval) avg_interval + + // Avg of modules interval when modules have module_interval > 0 + $interval_avgs_modules = db_get_all_rows_sql ("SELECT count(tagente_modulo.id_modulo) modules , tagente_modulo.id_modulo, AVG(tagente_modulo.module_interval) avg_interval FROM tagente_modulo, tagente_estado, tagente WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND tagente_modulo.disabled = 0 AND module_interval > 0 AND utimestamp > 0 AND delete_pending = 0 + AND tagente_modulo.disabled = 0 AND module_interval > 0 AND (utimestamp > 0 OR (id_tipo_modulo = 100 OR (id_tipo_modulo > 21 AND id_tipo_modulo < 23))) + AND delete_pending = 0 AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente GROUP BY tagente_modulo.id_modulo"); - foreach($interval_avgs as $ia) { - switch($ia['id_modulo']) { + if(empty($interval_avgs_modules)) { + $interval_avgs_modules = array(); + } + + // Transform into a easily format + foreach($interval_avgs_modules as $iamodules) { + $interval_avgs[$iamodules['id_modulo']]['avg_interval'] = $iamodules['avg_interval']; + $interval_avgs[$iamodules['id_modulo']]['modules'] = $iamodules['modules']; + } + + // Avg of agents interval when modules have module_interval == 0 + $interval_avgs_agents = db_get_all_rows_sql ("SELECT count(tagente_modulo.id_modulo) modules , tagente_modulo.id_modulo, AVG(tagente.intervalo) avg_interval + FROM tagente_modulo, tagente_estado, tagente + WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND tagente_modulo.disabled = 0 AND module_interval = 0 AND (utimestamp > 0 OR (id_tipo_modulo = 100 OR (id_tipo_modulo >= 21 AND id_tipo_modulo <= 24))) + AND delete_pending = 0 + AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente GROUP BY tagente_modulo.id_modulo"); + + if(empty($interval_avgs_agents)) { + $interval_avgs_agents = array(); + } + + // Merge with the previous calculated array + foreach($interval_avgs_agents as $iaagents) { + if(!isset($interval_avgs[$iaagents['id_modulo']]['modules'])) { + $interval_avgs[$iaagents['id_modulo']]['avg_interval'] = $iaagents['avg_interval']; + $interval_avgs[$iaagents['id_modulo']]['modules'] = $iaagents['modules']; + } + else { + $interval_avgs[$iaagents['id_modulo']]['avg_interval'] = servers_get_avg_interval($interval_avgs[$iaagents['id_modulo']], $iaagents); + $interval_avgs[$iaagents['id_modulo']]['modules'] += $iaagents['modules']; + } + } + + foreach($interval_avgs as $id_modulo => $ia) { + switch($id_modulo) { case MODULE_DATA: $data["avg_interval_local_modules"] = $ia['avg_interval']; $data["local_modules_rate"] = servers_get_rate($data["avg_interval_local_modules"], $data["total_local_modules"]); @@ -198,7 +234,7 @@ function servers_get_performance () { break; } - if($ia['id_modulo'] != MODULE_DATA) { + if($id_modulo != MODULE_DATA) { $data["avg_interval_remote_modules"][] = $ia['avg_interval']; } @@ -225,6 +261,23 @@ function servers_get_performance () { return ($data); } +/** + * Get avg interval + * + * @param mixed Array with avg and count data of first part + * @param mixed Array with avg and count data of second part + * + * @return float number of avg modules between two parts + */ + +function servers_get_avg_interval($modules_avg_interval1, $modules_avg_interval2) { + $total_modules = $modules_avg_interval1['modules'] + $modules_avg_interval2['modules']; + + $parcial1 = $modules_avg_interval1['avg_interval'] * $modules_avg_interval1['modules']; + $parcial2 = $modules_avg_interval2['avg_interval'] * $modules_avg_interval2['modules']; + + return ($parcial1 + $parcial2) / $total_modules; +} /** * Get server rate * diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index 94a9847a19..5c5940ff2f 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -223,6 +223,6 @@ $(document).ready (function () { $('#forced_title_layer').show(); }, function () { - $('#forced_title_layer').hide(); + $('#forced_title_layer').hide().empty(); }); }); diff --git a/pandora_console/operation/events/event_statistics.php b/pandora_console/operation/events/event_statistics.php index 9fd5589ee3..5f9821ee22 100644 --- a/pandora_console/operation/events/event_statistics.php +++ b/pandora_console/operation/events/event_statistics.php @@ -48,7 +48,7 @@ echo ""; echo ""; echo ""; -echo "

" . __('Event graph by group') . "

"; +echo "

" . __('Event graph by agent') . "

"; echo grafico_eventos_grupo(300, 200); echo "";