2009-02-13 Sancho Lerena <slerena@artica.es>
* 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. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1455 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e5a65eda12
commit
29a4431cbc
|
@ -1,3 +1,13 @@
|
|||
2009-02-13 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* 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 <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* include/footer.php, general/links_menu.php: _new is invalid. Use _blank
|
||||
|
|
|
@ -68,7 +68,8 @@ foreach ($modules as $module) {
|
|||
$data[1] = show_server_type ($module['id_modulo']);
|
||||
$data[1] .= ' <img src="images/'.show_icon_type ($module["id_tipo_modulo"]).'" border="0">';
|
||||
if (give_acl ($config['id_user'], $id_grupo, "AW"))
|
||||
$data[1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&update_module='.$module["id_agente_modulo"].'&moduletype='.$module["id_modulo"].'#modules"><img src="images/config.png"></a>';
|
||||
$data[1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&id_agent_module='.$module["id_agente_modulo"].'&edit_module='.$module["id_modulo"].'"><img src="images/config.png"></a>';
|
||||
|
||||
$data[2] = substr ($module["nombre"], 0, 25);
|
||||
$data[3] = substr ($module["descripcion"], 0, 35);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 '). "<b>" . get_agent_name ($origen). "- $agentmodule_name</b> ". __('from'). " <b>". $from_date. "</b> ". __('to'). " <b>". $to_date. "</b><br>";
|
||||
echo "<br>";
|
||||
|
||||
$from_date = date("U", strtotime($from_date));
|
||||
$to_date = date("U", strtotime($to_date));
|
||||
|
||||
// For each module
|
||||
for ($a=0;$a <count($origen_modulo); $a++){
|
||||
$id_modulo = $origen_modulo[$a];
|
||||
|
@ -175,14 +183,18 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
|
|||
<th class='datos'>".__('Data')."</th>
|
||||
<th class='datos'>Timestamp</th>";
|
||||
|
||||
// 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 <count($origen_modulo); $a++){ // For each module (not used multiple modules yet!)
|
||||
$id_modulo = $origen_modulo[$a];
|
||||
$tipo = get_moduletype_name (get_agentmodule_type ($id_modulo));
|
||||
if ($tipo == "generic_data_string")
|
||||
$sql1 = 'SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC';
|
||||
$sql1 = 'SELECT * FROM tagente_datos_string WHERE utimestamp > '.$from_date.' AND utimestamp < '.$to_date.' AND id_agente_modulo ='.$id_modulo.' ORDER BY utimestamp DESC';
|
||||
else
|
||||
$sql1 = 'SELECT * FROM tagente_datos WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC';
|
||||
$sql1 = 'SELECT * FROM tagente_datos WHERE utimestamp > '.$from_date.' AND utimestamp < '.$to_date.' AND id_agente_modulo ='.$id_modulo.' ORDER BY utimestamp DESC';
|
||||
$result1 = get_db_all_rows_sql ($sql1);
|
||||
$color=1;
|
||||
foreach ($result1 as $row){
|
||||
|
@ -198,7 +210,7 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
|
|||
echo "</td><td class='$tdcolor'>";
|
||||
echo $row["datos"];
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $row["timestamp"];
|
||||
echo $row["utimestamp"];
|
||||
echo "</td></tr>";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo __("Repeated");
|
||||
echo "</td><td>";
|
||||
print_checkbox ("group_rep", 1, $group_rep, false);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td colspan=4 align=right>";
|
||||
//The buttons
|
||||
echo '<td colspan=3>';
|
||||
print_submit_button (__('Update'), '', false, 'class="sub upd"');
|
||||
|
||||
// CSV
|
||||
|
@ -224,9 +230,16 @@ echo "</td></tr></table></form>"; //This is the internal table
|
|||
echo '<div style="width:220px; float:left;"><img src="reporting/fgraph.php?tipo=group_events&width=220&height=180&url='.rawurlencode ($sql_post).'" border="0"></div>';
|
||||
echo '</div><div style="clear:both"> </div>';
|
||||
|
||||
$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] = '<img src="images/err.png" title="'.__('Unknown type').': '.$row["event_type"].'" />';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Event description
|
||||
$data[2] = '<span title="'.$row["evento"].'" class="f9">';
|
||||
|
@ -345,6 +359,9 @@ foreach ($result as $row) {
|
|||
}
|
||||
$data[2] .= '</span>';
|
||||
|
||||
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] = '';
|
||||
|
|
Loading…
Reference in New Issue