2014-01-17 Sergio Martin <sergio.martin@artica.es>

* include/functions_events.php: Added ack_utimestamp and id_agent
	to the grouped events query to fix bad results



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9334 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2014-01-17 10:37:03 +00:00
parent 924a375d73
commit 21f82ff5fc
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2014-01-17 Sergio Martin <sergio.martin@artica.es>
* include/functions_events.php: Added ack_utimestamp and id_agent
to the grouped events query to fix bad results
2014-01-16 Miguel de Dios <miguel.dedios@artica.es> 2014-01-16 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/modificar_agente.php, * godmode/agentes/modificar_agente.php,

View File

@ -134,12 +134,15 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
MIN(utimestamp) AS timestamp_rep_min, MIN(utimestamp) AS timestamp_rep_min,
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user, (SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario, (SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario,
(SELECT criticity FROM tevento WHERE id_evento = MAX(te.id_evento)) AS criticity (SELECT id_agente FROM tevento WHERE id_evento = MAX(te.id_evento)) id_agente,
(SELECT criticity FROM tevento WHERE id_evento = MAX(te.id_evento)) AS criticity,
(SELECT ack_utimestamp FROM tevento WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp
FROM $table te FROM $table te
WHERE 1=1 " . $sql_post . " WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agentmodule" . $groupby_extra . " GROUP BY estado, evento, id_agentmodule" . $groupby_extra . "
ORDER BY timestamp_rep DESC LIMIT " . $offset . "," . $pagination; ORDER BY timestamp_rep DESC LIMIT " . $offset . "," . $pagination;
} }
break; break;
case "postgresql": case "postgresql":
if ($total) { if ($total) {
@ -155,7 +158,9 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
MIN(utimestamp) AS timestamp_rep_min, MIN(utimestamp) AS timestamp_rep_min,
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user, (SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario, (SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario,
(SELECT criticity FROM tevento WHERE id_evento = MAX(te.id_evento)) AS criticity (SELECT id_agente FROM tevento WHERE id_evento = MAX(te.id_evento)) id_agente,
(SELECT criticity FROM tevento WHERE id_evento = MAX(te.id_evento)) AS criticity,
(SELECT ack_utimestamp FROM tevento WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp
FROM $table te FROM $table te
WHERE 1=1 " . $sql_post . " WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra" . $groupby_extra . " GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra" . $groupby_extra . "