From 61655acb25dfb1b03aeac1a06a1cc6e89725adf4 Mon Sep 17 00:00:00 2001 From: raulmateos Date: Wed, 3 Dec 2008 12:41:09 +0000 Subject: [PATCH] 2008-12-03 Raul Mateos * include/functions_db.php: Now if no event, table shows "no event" text. Cosmetic table header change. * operation/agentes/tactical.php: Solve warning if no servers defined. Cosmetic table header change. * operation/events/events.php: Change "error" class to "not found" class. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1280 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 + pandora_console/include/functions_db.php | 191 ++++++++++-------- .../operation/agentes/tactical.php | 48 +++-- pandora_console/operation/events/events.php | 2 +- 4 files changed, 142 insertions(+), 109 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fab8be419e..968712401f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2008-12-03 Raul Mateos + + * include/functions_db.php: Now if no event, table shows "no event" text. + Cosmetic table header change. + + * operation/agentes/tactical.php: Solve warning if no servers defined. + Cosmetic table header change. + + * operation/events/events.php: Change "error" class to "not found" class. + 2008-12-02 Jorge Gonzalez * include/languages/index.pot: Updated Spanish translation. diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index e2117f911d..75fdf4c832 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2125,100 +2125,113 @@ function show_alert_row_mini ($id_combined_alert) { */ function smal_event_table ($filter = "", $limit = 10, $width = 440) { global $config; - - $sql = sprintf ("SELECT * FROM tevento %s ORDER BY timestamp DESC LIMIT %d",$filter,$limit); - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + $sql = sprintf ("SELECT * FROM tevento %s + ORDER BY timestamp DESC LIMIT %d", + $filter, $limit); $result = get_db_all_rows_sql ($sql); - if($result === false) - $result = array(); - foreach ($result as $event) { - $id_grupo = $event["id_grupo"]; - if (! give_acl ($config["id_user"], $id_grupo, "AR")) { - continue; - } - - /* Only incident read access to view data ! */ - $tdclass = get_priority_class ($event["criticity"]); - $criticity_label = get_priority_name ($event["criticity"]); - /* Colored box */ - echo "
".__('Latest events')."
".__('St')."".__('Type')."".__('Event name')."".__('Agent name')."".__('User ID')."".__('Timestamp')."
"; - if ($event["estado"] == 0) { - echo ""; - } else { - echo ""; - } - /* Event type */ - echo ""; - switch ($event["event_type"]) { - case "unknown": - echo ""; - break; - case "alert_recovered": - echo ""; - break; - case "alert_manual_validation": - echo ""; - break; - case "monitor_up": - echo ""; - break; - case "monitor_down": - echo ""; - break; - case "alert_fired": - echo ""; - break; - case "system"; - echo ""; - break; - case "recon_host_detected"; - echo ""; - break; - } - // Event description - echo ""; - echo substr ($event["evento"],0,45); - if (strlen ($event["evento"]) > 45) { - echo ".."; - } - if ($event["id_agente"] > 0) { - // Agent name - $agent_name = dame_nombre_agente ($event["id_agente"]); - echo ""; - echo substr ($agent_name, 0, 14); - if (strlen ($agent_name) > 14) - echo ".."; - echo ""; - - // for System or SNMP generated alerts - } else { - if ($event["event_type"] == "system") { - echo "".__('System'); - } else { - echo "".__('Alert')."SNMP"; + if ($result === false) { + $result = array (); + echo '
'.__('No events').'
'; + } else { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + foreach ($result as $event) { + $id_grupo = $event["id_grupo"]; + if (! give_acl ($config["id_user"], $id_grupo, "AR")) { + continue; } + + /* Only incident read access to view data ! */ + $tdclass = get_priority_class ($event["criticity"]); + $criticity_label = get_priority_name ($event["criticity"]); + /* Colored box */ + echo ""; + echo ""; + /* Event type */ + echo ""; + // Event description + echo ""; + if ($event["id_agente"] > 0) { + // Agent name + $agent_name = dame_nombre_agente ($event["id_agente"]); + echo ""; + + // for System or SNMP generated alerts + } else { + if ($event["event_type"] == "system") { + echo ""; + } else { + echo ""; + } + } + + // User who validated event + echo ""; + // Timestamp + echo ""; + echo ""; } - - // User who validated event - echo "
".__('Latest events')."
".__('St')."".__('Type')."".__('Event name')."".__('Agent name')."".__('User ID')."".__('Timestamp')."
"; + if ($event["estado"] == 0) { + echo ""; + } else { + echo ""; + } + echo ""; + switch ($event["event_type"]) { + case "unknown": + echo ""; + break; + case "alert_recovered": + echo ""; + break; + case "alert_manual_validation": + echo ""; + break; + case "monitor_up": + echo ""; + break; + case "monitor_down": + echo ""; + break; + case "alert_fired": + echo ""; + break; + case "system"; + echo ""; + break; + case "recon_host_detected"; + echo ""; + break; + } + echo ""; + echo substr ($event["evento"],0,45); + if (strlen ($event["evento"]) > 45) { + echo ".."; + } + echo ""; + echo substr ($agent_name, 0, 14); + if (strlen ($agent_name) > 14) + echo ".."; + echo ""; + echo "".__('System')."".__('Alert')."SNMP"; + if ($event["estado"] != 0) { + echo "".substr ($event["id_usuario"],0,8)." ".dame_nombre_real ($event["id_usuario"]).""; + } + echo ""; + echo human_time_comparation ($event["timestamp"]); + echo "
"; - if ($event["estado"] != 0) { - echo "".substr ($event["id_usuario"],0,8)." ".dame_nombre_real ($event["id_usuario"]).""; - } - // Timestamp - echo ""; - echo human_time_comparation ($event["timestamp"]); + echo "
"; } - echo "
"; } diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index 12aa36a021..78897b4f1e 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -1,14 +1,14 @@ '; // Server information -echo ''; -echo ''; -echo ''; - $serverinfo = get_server_info (); $total_modules = get_agentmodule_count (); $cells = array (); -foreach ($serverinfo as $server_id => $server_info) { +if ($serverinfo) { + + echo '
'.__('Tactical server information').'
'.__('Name').''.__('Status').''.__('Load').''.__('Lag').pandora_help ("serverlag", true).'
'; + echo ' + + + '; + echo ' + + + + + '; + + foreach ($serverinfo as $server_id => $server_info) { $data = array (); $data[0] = $server_info["name"]; @@ -220,8 +230,8 @@ foreach ($serverinfo as $server_id => $server_info) { } else { $data[1] = ''; } - - + + if ($server_info["modules"] > 0 && $total_modules > 0) { $percent = $server_info["modules"] / ($total_modules / 100); } else { @@ -232,9 +242,9 @@ foreach ($serverinfo as $server_id => $server_info) { $data[3] = $server_info["lag"]." / ".$server_info["module_lag"]; array_push ($cells, $data); -} + } -foreach ($cells as $key => $row) { + foreach ($cells as $key => $row) { //Switch class around $class = (($key % 2) ? "datos2" : "datos"); echo ' @@ -242,10 +252,10 @@ foreach ($cells as $key => $row) { - '; + '; + } + echo '
'.__('Tactical server information').'
'.__('Name').''.__('Status').''.__('Load').''.__('Lag').pandora_help ("serverlag", true).'
'.$row[1].' '.$row[2].' '.$row[3].'
'; } -echo ''; - smal_event_table ("", 10, 450); echo ''; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 3b7ad4b5bc..2de0a136ab 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -388,7 +388,7 @@ if (!empty ($table->data)) { } echo ''; } else { - echo '
'.__('No events').'
'; + echo '
'.__('No events').'
'; } unset ($table);