diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 565c43542b..0ffb6654d0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2009-02-13 Sancho Lerena + + * operation/events/events.php: Added new feature: Group similar event by + showing the event and the total repeated times. + + * operation/agentes/export_csv.php, + operation/agentes/exportdata.php: Fixed problems with old timestamp. + + * operation/agentes/estado_monitores.php: Fixed link to module edition. + 2009-02-12 Evi Vanoost * include/footer.php, general/links_menu.php: _new is invalid. Use _blank diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index c36d1015a2..9bf0fcb63c 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -68,7 +68,8 @@ foreach ($modules as $module) { $data[1] = show_server_type ($module['id_modulo']); $data[1] .= ' '; if (give_acl ($config['id_user'], $id_grupo, "AW")) - $data[1] .= ''; + $data[1] .= ''; + $data[2] = substr ($module["nombre"], 0, 25); $data[3] = substr ($module["descripcion"], 0, 35); diff --git a/pandora_console/operation/agentes/export_csv.php b/pandora_console/operation/agentes/export_csv.php index 20abae6001..bf7d9cb835 100644 --- a/pandora_console/operation/agentes/export_csv.php +++ b/pandora_console/operation/agentes/export_csv.php @@ -54,14 +54,18 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){ $to_date = $_GET["to_date"]; else $to_date = $now; - + + // Convert to unix date + $from_date = date("U", strtotime($from_date)); + $to_date = date("U", strtotime($to_date)); + // Make the query $sql1="SELECT * FROM tdatos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agentmodule"; $tipo = get_moduletype_name (get_agentmodule_type ($id_agentmodule)); if ($tipo == "generic_data_string") - $sql1='SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC'; + $sql1 = "SELECT * FROM tagente_datos_string WHERE utimestamp > $from_date AND utimestamp < $to_date AND id_agente_modulo = $id_agentmodule ORDER BY utimestamp DESC"; else - $sql1='SELECT * FROM tagente_datos WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC'; + $sql1 = "SELECT * FROM tagente_datos WHERE utimestamp > $from_date AND utimestamp < $to_date AND id_agente_modulo = $id_agentmodule ORDER BY utimestamp DESC"; $result1=mysql_query($sql1); // Render data @@ -70,7 +74,7 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){ echo ","; echo $row["datos"]; echo ","; - echo $row["timestamp"]; + echo $row["utimestamp"]; echo chr(13); } } diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index 209082141d..6238b1a38d 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -33,13 +33,18 @@ function give_average_from_module ($id_agente, $id_agente_modulo, $hour, $day, $ // Return average value from an agentmodule, for a specific hour of specific day of week, // Only valid for non-string kind of data. require ("include/config.php"); + + // Convert to unix date + $start_date = date("U", $start_date); + $end_date = date("U", $end_date); + $query1 = "SELECT AVG(datos) FROM tagente_datos WHERE id_agente_modulo = ". $id_agente_modulo." - AND HOUR(timestamp) = ".$hour." - AND WEEKDAY(timestamp) = ".$day." - AND timestamp >= '$start_date' - AND timestamp <= '$end_date'"; + AND HOUR(utimestamp) = ".$hour." + AND WEEKDAY(utimestamp) = ".$day." + AND utimestamp >= $start_date + AND utimestamp <= $end_date"; if (($resq1 = mysql_query($query1)) AND ($row=mysql_fetch_array($resq1))) return $row[0]; @@ -138,6 +143,9 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){ echo __('Data from agent '). "" . get_agent_name ($origen). "- $agentmodule_name ". __('from'). " ". $from_date. " ". __('to'). " ". $to_date. "
"; echo "
"; + $from_date = date("U", strtotime($from_date)); + $to_date = date("U", strtotime($to_date)); + // For each module for ($a=0;$a ".__('Data')." Timestamp"; + // Convert to unix date + $from_date = date("U", strtotime($from_date)); + $to_date = date("U", strtotime($to_date)); + // Begin the render ! for ($a=0; $a "; echo $row["datos"]; echo ""; - echo $row["timestamp"]; + echo $row["utimestamp"]; echo ""; } } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index ffb13719ab..a25b2ebed3 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -62,6 +62,7 @@ $pagination = (int) get_parameter ("pagination", $config["block_size"]); $groups = get_user_groups ($config["id_user"], "IR"); $event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]); $id_user_ack = (int) get_parameter ("id_user_ack", 0); +$group_rep = (int) get_parameter ("group_rep", 0); //Group selection if ($ev_group > 1 && in_array ($ev_group, array_keys ($groups))) { @@ -205,9 +206,14 @@ foreach ($users as $id_user => $user) { print_select ($values, "id_user_ack", $id_user_ack, '', __('Any'), 0); echo ""; +echo ""; +echo __("Repeated"); +echo ""; +print_checkbox ("group_rep", 1, $group_rep, false); +echo ""; +echo ""; //The buttons -echo ''; print_submit_button (__('Update'), '', false, 'class="sub upd"'); // CSV @@ -224,9 +230,16 @@ echo ""; //This is the internal table echo '
'; echo '
 
'; -$sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination; +if ($group_rep == 0) + $sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination; +else + $sql = "SELECT *, COUNT(*) AS event_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination; + $result = get_db_all_rows_sql ($sql); -$sql = "SELECT COUNT(id_evento) FROM tevento WHERE id_evento > 0 ".$sql_post; +if ($group_rep == 0) + $sql = "SELECT COUNT(id_evento) FROM tevento WHERE id_evento > 0 ".$sql_post; +else + $sql = "SELECT COUNT(id_evento) FROM tevento WHERE id_evento > 0 ".$sql_post." GROUP BY evento, id_agentmodule"; $total_events = get_db_sql ($sql); if (empty ($result)) { @@ -335,6 +348,7 @@ foreach ($result as $row) { $data[1] = ''; break; } + // Event description $data[2] = ''; @@ -345,6 +359,9 @@ foreach ($result as $row) { } $data[2] .= ''; + if ($group_rep == 1) + $data[2] .= " ( ".$row["event_rep"] . " ) "; + if ($row["event_type"] == "system") { $data[3] = __('System'); } elseif ($row["id_agente"] > 0) { @@ -380,9 +397,17 @@ foreach ($result as $row) { } else { $data[6] = ''; } + + //Time - //Time - $data[7] = print_timestamp ($row["timestamp"], true); + if ($group_rep == 1){ + if ($row["event_rep"] == 1) + $data[7] = print_timestamp ($row["timestamp"], true); + else + $data[7] = print_timestamp (get_db_sql ("SELECT timestamp FROM tevento WHERE id_agentmodule = ".$row["id_agentmodule"]." AND evento = '".$row["evento"]."' ORDER BY utimestamp DESC LIMIT 1"), true); + } else { + $data[7] = print_timestamp ($row["timestamp"], true); + } //Actions $data[8] = '';