From ddebc4258508693372792f87ad2c2b7d43ee2650 Mon Sep 17 00:00:00 2001 From: slerena Date: Mon, 16 Jul 2007 18:47:39 +0000 Subject: [PATCH] 2007-07-16 Sancho Lerena * include/functions_db.php: Bugfix; list_group and list_group2 funtions now include all group in result. All group recheck should be done inside code, not in this function. * operation/agentes/estado_grupo.php: Fixed bug with ALL group. * operation/agentes/estado_monitores.php: Bugfix, Now show only initialized modules. * operation/agentes/estado_agente.php: Bugfixed, "All" group problem, and agent names are truncated if > 18 chars. * operation/agentes/tactical.php: Bugfixed, now calculates LAG and module count properly. * operation/servers/view_server.php: Bugfixed, now calculates LAG and module count properly. * reporting/fgraph.php: Bugfix: Renamed static problem image. * godmode/agentes/configurar_agente.php: Bugfix, agent address management in manual creation. * godmode/agentes/agent_manager.php: Bugfix, #1744913 (show icon in creation) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@563 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 26 ++++++ .../godmode/agentes/agent_manager.php | 5 +- pandora_console/include/functions_db.php | 8 +- .../operation/agentes/estado_agente.php | 3 +- .../agentes/estado_generalagente.php | 1 - .../operation/agentes/estado_grupo.php | 4 +- .../operation/agentes/estado_monitores.php | 2 +- .../operation/agentes/tactical.php | 85 ++++++++++--------- .../operation/servers/view_server.php | 24 +++--- pandora_console/reporting/fgraph.php | 2 +- 10 files changed, 91 insertions(+), 69 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c4fcb4496a..a63abd66b3 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,29 @@ +2007-07-16 Sancho Lerena + + * include/functions_db.php: Bugfix; list_group and list_group2 funtions + now include all group in result. All group recheck should be done inside code, not in + this function. + + * operation/agentes/estado_grupo.php: Fixed bug with ALL group. + + * operation/agentes/estado_monitores.php: Bugfix, Now show only initialized modules. + + * operation/agentes/estado_agente.php: Bugfixed, "All" group problem, + and agent names are truncated if > 18 chars. + + * operation/agentes/tactical.php: Bugfixed, now calculates LAG and module + count properly. + + * operation/servers/view_server.php: Bugfixed, now calculates LAG and module + count properly. + + * reporting/fgraph.php: Bugfix: Renamed static problem image. + + * godmode/agentes/configurar_agente.php: Bugfix, agent address management + in manual creation. + + * godmode/agentes/agent_manager.php: Bugfix, #1744913 (show icon in creation) + 2007-07-13 Sancho Lerena * img/so_other.png: Fixed image. diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 805af7f9d1..d976fa2f0d 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -63,9 +63,8 @@ echo ""; echo ''.$lang_label["agent_name"].' '; -if (isset($_GET["creacion"])){ - echo " "; -} else { + +if (!isset($_GET["create_agent"])){ echo " diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 2bb7ff8a0f..a94fb9fb48 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -772,7 +772,7 @@ function list_group ($id_user){ $sql='SELECT id_grupo FROM tgrupo'; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)){ - if ($row["id_grupo"] != 1){ + if ($row["id_grupo"] != 0){ if (give_acl($id_user,$row["id_grupo"], "AR") == 1){ array_push ($mis_grupos, $row["id_grupo"]); //Put in an array all the groups the user belongs echo ""; } - echo ""; // Group all is always active $mis_grupos=list_group ($id_user); //Print combo for groups and set an array with all groups echo ""; @@ -124,7 +123,7 @@ if (comprueba_login() == 0) { while ($row=mysql_fetch_array($result)){ $intervalo = $row["intervalo"]; // Interval in seconds $id_agente = $row['id_agente']; - $nombre_agente = strtoupper($row["nombre"]); + $nombre_agente = substr(strtoupper($row["nombre"]),0,18); $direccion_agente =$row["direccion"]; $id_grupo=$row["id_grupo"]; $id_os = $row["id_os"]; diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index d1deca70d1..7ad18ed119 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -174,7 +174,6 @@ if (comprueba_login() == 0) { $ultima = strtotime($ultima_act); $ahora = strtotime("now"); $diferencia = $ahora - $ultima; - // Get higher interval set for the set of modules from this agent $sql_maxi ="SELECT MAX(module_interval) FROM tagente_modulo WHERE id_agente = ".$id_agente; $result_maxi=mysql_query($sql_maxi); diff --git a/pandora_console/operation/agentes/estado_grupo.php b/pandora_console/operation/agentes/estado_grupo.php index 304e02fda3..a0edbcac85 100644 --- a/pandora_console/operation/agentes/estado_grupo.php +++ b/pandora_console/operation/agentes/estado_grupo.php @@ -65,7 +65,7 @@ // Prepare data to show // For each valid group for this user, take data from agent and modules foreach ($mis_grupos as $migrupo) { - if ($migrupo != "") { + if (($migrupo != "") && ($migrupo != 1)) { $existen_agentes = 0; $grupo[$array_index]["agent"] = 0; $grupo[$array_index]["ok"] = 0; @@ -262,4 +262,4 @@ } -?> \ No newline at end of file +?> diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 820c534594..1dab51a28c 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -24,7 +24,7 @@ if (comprueba_login() == 0) { $id_agente = $_GET["id_agente"]; } // Get all module from agent - $sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente='.$id_agente.' AND tagente_estado.estado != 100 order by tagente_modulo.nombre'; + $sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agente.' and tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 order by tagente_modulo.nombre'; $result_t=mysql_query($sql_t); if (mysql_num_rows ($result_t)) { echo "

".$lang_label["monitor_listing"]." ".$lang_label["help"]."

"; diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index 7cde7a02af..1e29b07787 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -259,48 +259,49 @@ echo "-"; // LAG CHECK - echo ""; - // Calculate lag: get oldest module of any proc_type, for this server, - // and calculate difference in seconds - // Get total modules defined for this server - if (($network_server == 1) OR ($data_server == 1)){ - $sql1 = "SELECT utimestamp, current_interval FROM tagente_estado WHERE processed_by_server = '$name' AND estado < 100"; - - $nowtime = time(); - $maxlag=0; - if ($result1=mysql_query($sql1)) - while ($row1=mysql_fetch_array($result1)){ - if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime) - $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]); - if ($maxlag2 > $maxlag) - $maxlag = $maxlag2; - } - if ($maxlag < 60) - echo $maxlag." sec"; - elseif ($maxlag < 86400) - echo format_numeric($maxlag/60) . " min"; - elseif ($maxlag > 86400) - echo "+1 ".$lang_label["day"]; - } elseif ($recon_server == 1) { - $sql1 = "SELECT * FROM trecon_task WHERE id_network_server = $id_server"; - $result1=mysql_query($sql1); - $nowtime = time(); - $maxlag=0;$maxlag2=0; - while ($row1=mysql_fetch_array($result1)){ - if (($row1["utimestamp"] + $row1["interval_sweep"]) < $nowtime){ - $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["interval_sweep"]); - if ($maxlag2 > $maxlag) - $maxlag = $maxlag2; - } - } - if ($maxlag < 60) - echo $maxlag." sec"; - elseif ($maxlag < 86400) - echo format_numeric($maxlag/60) . " min"; - elseif ($maxlag > 86400) - echo "+1 ".$lang_label["day"]; - } else - echo "--"; + echo ""; + // Calculate lag: get oldest module of any proc_type, for this server, + // and calculate difference in seconds + // Get total modules defined for this server + if (($network_server == 1) OR ($data_server == 1)){ + $sql1 = "SELECT MIN(utimestamp),current_interval FROM tagente_estado WHERE utimestamp > 0 AND running_by=$id_server GROUP BY current_interval ORDER BY 1"; + $nowtime = time(); + $maxlag=0; + if ($result1=mysql_query($sql1)) + while ($row1=mysql_fetch_array($result1)){ + if (($row1[0] + $row1[1]) < $nowtime){ + $maxlag2 = $nowtime - ($row1[0] + $row1[1]); + if ($maxlag2 > $maxlag) + $maxlag = $maxlag2; + } + } + if ($maxlag < 60) + echo $maxlag." sec"; + elseif ($maxlag < 86400) + echo format_numeric($maxlag/60) . " min"; + elseif ($maxlag > 86400) + echo "+1 ".$lang_label["day"]; + } elseif ($recon_server == 1) { + $sql1 = "SELECT * FROM trecon_task WHERE id_network_server = $id_server"; + $result1=mysql_query($sql1); + $nowtime = time(); + $maxlag=0;$maxlag2=0; + while ($row1=mysql_fetch_array($result1)){ + if (($row1["utimestamp"] + $row1["interval_sweep"]) < $nowtime){ + $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["interval_sweep"]); + if ($maxlag2 > $maxlag) + $maxlag = $maxlag2; + } + } + if ($maxlag < 60) + echo $maxlag." sec"; + elseif ($maxlag < 86400) + echo format_numeric($maxlag/60) . " min"; + elseif ($maxlag > 86400) + echo "+1 ".$lang_label["day"]; + } else + echo "--"; + } } echo ''; diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index b3dc24c5d7..1336db423e 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -21,7 +21,7 @@ require("include/config.php"); $modules_server = 0; -$total_modules = 0; +$total_modules_network = 0; $total_modules_data = 0; if (comprueba_login() == 0) { @@ -36,10 +36,10 @@ if (comprueba_login() == 0) { $sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4'; $result1=mysql_query($sql1); $row1=mysql_fetch_array($result1); - $total_modules = $row1[0]; + $total_modules_network = $row1[0]; // Get total modules defined (data) - $sql1='SELECT COUNT(processed_by_server) FROM tagente_estado WHERE processed_by_server LIKE "%_Data" '; + $sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 AND id_tipo_modulo != -1'; if ($result1=mysql_query($sql1)){ $row1=mysql_fetch_array($result1); $total_modules_data = $row1[0]; @@ -88,7 +88,7 @@ if (comprueba_login() == 0) { if (($network_server == 1) OR ($data_server == 1)) if ($network_server == 1){ // Get total modules defined for this server (network modules) - $sql1='SELECT * FROM tagente where id_server = '.$row["id_server"]; + $sql1='SELECT * FROM tagente WHERE id_server = '.$row["id_server"]; $result1=mysql_query($sql1); while ($row1=mysql_fetch_array($result1)){ $sql2='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_agente = '.$row1["id_agente"]; @@ -119,13 +119,13 @@ if (comprueba_login() == 0) { if (($network_server == 1) OR ($data_server == 1)){ // Progress bar calculations if ($network_server == 1){ - if ($total_modules == 0) + if ($total_modules_network == 0) $percentil = 0; - if ($total_modules > 0) - $percentil = $modules_server / ($total_modules / 100); + if ($total_modules_network > 0) + $percentil = $modules_server / ($total_modules_network / 100); else $percentil = 0; - $total_modules_temp = $total_modules; + $total_modules_temp = $total_modules_network; } else { if ($total_modules_data == 0) $percentil = 0; @@ -170,16 +170,16 @@ if (comprueba_login() == 0) { // and calculate difference in seconds // Get total modules defined for this server if (($network_server == 1) OR ($data_server == 1)){ - $sql1 = "SELECT utimestamp, current_interval FROM tagente_estado WHERE processed_by_server = '$name' AND estado < 100"; - + $sql1 = "SELECT MIN(utimestamp),current_interval FROM tagente_estado WHERE utimestamp > 0 AND running_by=$id_server GROUP BY current_interval ORDER BY 1"; $nowtime = time(); $maxlag=0; if ($result1=mysql_query($sql1)) while ($row1=mysql_fetch_array($result1)){ - if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime) - $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]); + if (($row1[0] + $row1[1]) < $nowtime){ + $maxlag2 = $nowtime - ($row1[0] + $row1[1]); if ($maxlag2 > $maxlag) $maxlag = $maxlag2; + } } if ($maxlag < 60) echo $maxlag." sec"; diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index 0a30673f6a..d6c7172ce8 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -1392,7 +1392,7 @@ function progress_bar($progress,$width,$height) { if ($progress > 100 || $progress < 0){ // HACK: This report a static image... will increase render in about 200% :-) useful for // high number of realtime statusbar images creation (in main all agents view, for example - $imgPng = imageCreateFromPng("../images/outlimits.png"); + $imgPng = imageCreateFromPng("../images/outof.png"); imageAlphaBlending($imgPng, true); imageSaveAlpha($imgPng, true); imagePng($imgPng);