2013-03-01 Sergio Martin <sergio.martin@artica.es>

* 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



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7762 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-03-01 10:00:42 +00:00
parent 3714f6837a
commit a25e567a30
6 changed files with 75 additions and 13 deletions

View File

@ -1,3 +1,12 @@
2013-03-01 Sergio Martin <sergio.martin@artica.es>
* 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 <sergio.martin@artica.es>
* include/javascript/pandora_events.js

View File

@ -87,7 +87,6 @@ echo '<div style="width:50%; float:left; padding-right: 30px;" id="leftcolumn">'
$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 '<div style="width:50%; float:left; padding-right: 30px;" id="leftcolumn">'
$data[0] = '<strong>' . $session_id_usuario . '</strong>';
$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']);

View File

@ -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":

View File

@ -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
*

View File

@ -223,6 +223,6 @@ $(document).ready (function () {
$('#forced_title_layer').show();
},
function () {
$('#forced_title_layer').hide();
$('#forced_title_layer').hide().empty();
});
});

View File

@ -48,7 +48,7 @@ echo "</tr>";
echo "<tr>";
echo "<td>";
echo "<h3>" . __('Event graph by group') . "</h3>";
echo "<h3>" . __('Event graph by agent') . "</h3>";
echo grafico_eventos_grupo(300, 200);
echo "</td>";