From 877dbf94cc282abf3583e7bb1e223627136cdd62 Mon Sep 17 00:00:00 2001
From: slerena <slerena@gmail.com>
Date: Fri, 21 Sep 2007 12:31:22 +0000
Subject: [PATCH] 2007-09-20  Sancho Lerena <slerena@gmail.com>

        * view_server.php, tactical.php: Solved bug in lagcheck for down modules.

        * godmode/agentes/manage_config.php: Agent ordered by name in destination box.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@657 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                         | 4 ++++
 pandora_console/godmode/agentes/manage_config.php | 2 +-
 pandora_console/operation/agentes/tactical.php    | 7 +++++--
 pandora_console/operation/servers/view_server.php | 7 +++++--
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index fa93eef1da..6b01b832ea 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,4 +1,8 @@
+2007-09-20  Sancho Lerena <slerena@gmail.com>
 
+	* view_server.php, tactical.php: Solved bug in lagcheck for down modules.
+
+	* godmode/agentes/manage_config.php: Agent ordered by name in destination box.
 
 2007-09-08  Raul Mateos <raulofpandora@gmail.com>
 
diff --git a/pandora_console/godmode/agentes/manage_config.php b/pandora_console/godmode/agentes/manage_config.php
index 8a80614564..563cd787a7 100644
--- a/pandora_console/godmode/agentes/manage_config.php
+++ b/pandora_console/godmode/agentes/manage_config.php
@@ -314,7 +314,7 @@ if (comprueba_login() == 0)
 			<select name=destino[] size=10 multiple=yes style='width: 175px;'>
 			<?php
 			// Show combo with agents
-			$sql1='SELECT * FROM tagente';
+			$sql1='SELECT * FROM tagente order by nombre';
 			$result=mysql_query($sql1);
 			while ($row=mysql_fetch_array($result)){
 				echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php
index d1e65a6e7b..e088d616da 100644
--- a/pandora_console/operation/agentes/tactical.php
+++ b/pandora_console/operation/agentes/tactical.php
@@ -286,8 +286,11 @@
 	                                        while ($row1=mysql_fetch_array($result1)){
 	                                                if (($row1[0] + $row1[1]) < $nowtime){
 	                                                        $maxlag2 =  $nowtime - ($row1[0] + $row1[1]);
-	                                                        if ($maxlag2 > $maxlag)
-	                                                                $maxlag = $maxlag2;
+								// More than 5 times module interval is not lag, is a big
+								// problem in agent, network or servers..
+								if ($maxlag2 < ($row1[1]*5))
+	                                                       	 	if ($maxlag2 > $maxlag)
+	                                                                	$maxlag = $maxlag2;
         	                                        }
                 	                        }
                         	        if ($maxlag < 60)
diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php
index 74f3fbb797..50a7541019 100644
--- a/pandora_console/operation/servers/view_server.php
+++ b/pandora_console/operation/servers/view_server.php
@@ -171,8 +171,11 @@ if (comprueba_login() == 0) {
 				while ($row1=mysql_fetch_array($result1)){
 					if (($row1[0] + $row1[1]) < $nowtime){
 						$maxlag2 =  $nowtime - ($row1[0] + $row1[1]);
-						if ($maxlag2 > $maxlag)
-							$maxlag = $maxlag2;
+						// More than 5 times module interval is not lag, is a big
+						// problem in agent, network or servers..
+						if ($maxlag2 < ($row1[1]*5))
+							if ($maxlag2 > $maxlag)
+								$maxlag = $maxlag2;
 					}
 				}
 				if ($maxlag < 60)