From f2cc53909a09ae3c5eaa0aecc079d70ce4cc4795 Mon Sep 17 00:00:00 2001 From: slerena Date: Thu, 29 Jun 2006 19:29:20 +0000 Subject: [PATCH] * estado_grupo.php, some important changes and fixes: - New feature to referesh ALL the network modules under a group if push the "network refresh" button. - Need to be finished by Raul, to show detailed info only in the hint. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@61 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- .../operation/agentes/estado_grupo.php | 89 +++++++++++-------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/pandora_console/operation/agentes/estado_grupo.php b/pandora_console/operation/agentes/estado_grupo.php index 73a4b17e14..e630b6ae52 100644 --- a/pandora_console/operation/agentes/estado_grupo.php +++ b/pandora_console/operation/agentes/estado_grupo.php @@ -1,22 +1,42 @@ , 2003-2006 -// Raúl Mateos , 2005-2006 +// Pandora - the Free monitoring system +// ==================================== +// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com +// Copyright (c) 2005-2006 Artica Soluciones Tecnológicas S.L, info@artica.es +// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars require("include/config.php"); - if (comprueba_login() == 0) if (give_acl($id_user, 0, "AR")==1) { echo "

".$lang_label["ag_title"]."

"; echo "

".$lang_label["group_view"]."

"; - + // Check for Network FLAG change request + if (isset($_GET["update_netgroup"])){ + if (give_acl($id_user, $_GET["update_netgroup"], "AW")==1){ + $sql = "SELECT * FROM tagente where id_grupo = ".$_GET["update_netgroup"]; + $result=mysql_query($sql); + while ($row=mysql_fetch_array($result)){ + $id_agente = $row["id_agente"]; + $query2 ="UPDATE tagente_modulo SET flag=1 WHERE id_agente = ".$id_agente; + $res=mysql_query($query2); + } + echo "

".$lang_label["network_module_refresh_exec"]."

"; + } + } $iduser_temp=$_SESSION['id_usuario']; // $mis_grupos - Define array mis_grupos to put here all groups with Agent Read permission - $sql1='SELECT * FROM tgrupo'; $result2=mysql_query($sql1); while ($row=mysql_fetch_array($result2)){ @@ -30,10 +50,6 @@ if (comprueba_login() == 0) $estado_grupo_ok =0; $estado_grupo_down =0; $estado_grupo_bad =0; - -// Debug -// echo "tengo un total de ".count($mis_grupos)." grupos

"; - // Recorro cada grupo para ver el estado de todos los modulos foreach ($mis_grupos as $migrupo) if ($migrupo != "") { @@ -63,12 +79,11 @@ if (comprueba_login() == 0) $estado_grupo_down++; $down=1; } - $grupo[$array_index]["agent"]++; $grupo[$array_index]["group"]=dame_nombre_grupo($migrupo); $contador_agente++; // Estado grupo, agent if ($down ==0){ - $sql2="SELECT * FROM tagente_modulo WHERE (id_tipo_modulo = 2 OR id_tipo_modulo = 6 OR id_tipo_modulo = 10) AND id_agente =".$row1["id_agente"]; + $sql2="SELECT * FROM tagente_modulo WHERE (id_tipo_modulo = 2 OR id_tipo_modulo = 6 OR id_tipo_modulo = 9 OR id_tipo_modulo = 12 OR id_tipo_modulo = 18) AND id_agente =".$row1["id_agente"]; $result2=mysql_query($sql2); while ($row2 = mysql_fetch_array($result2)){ $sql3="SELECT * FROM tagente_estado WHERE id_agente_modulo = ".$row2["id_agente_modulo"]; @@ -82,37 +97,22 @@ if (comprueba_login() == 0) $estado_grupo_bad++; $grupo[$array_index]["bad"]++; // Estado grupo, agent BAD } - } + $grupo[$array_index]["ok"]; } } - if ($existen_agentes == 1){ $array_index++; } } if ($contador_agente==0) {echo "".$lang_label["no_agent_def"]."";} -/* -for ($a=0; $a < $array_index; $a++) -{ -// Debug, show all groups parsed as valid -echo $grupo[$a]['group']; -//echo $grupo[$a]["icon"]; -echo "
"; -} -*/ - - //echo "Count ".$contador_grupo."

"; $ancho = ceil(sqrt($array_index+1)); - -//echo "DEBUG ANCHO: $ancho
"; $real_count =0; // Puedo tener una tabla con mas items en ella que los que realmente debo mostrar, real count cuenta los que voy poniendo hasta llegar a array_index que son los que hay en el array $grupo. echo ""; for ($table=0;$table < $ancho-1;$table++){ echo ""; for ($table_row=0;$table_row < $ancho;$table_row++){ if ($real_count < $array_index){ - $group_name = $grupo[$real_count]["group"]; $icono_grupo = $grupo[$real_count]["icon"]; $icono_type=""; @@ -125,27 +125,40 @@ echo "
"; if ($grupo[$real_count]["ok"]>0) { $icono_type=$icono_type.""; } - - $celda = ""; echo $celda; } $real_count++; } echo ""; } - echo "
- + // Icon with tooltip table inside (Raul) + $celda = " "; + $celda = $celda."
".$lang_label["agents"].":
".$grupo[$real_count]["agent"]."
- +
".ucfirst($lang_label["monitors"]).":
".$lang_label["ok"].": ".$grupo[$real_count]["ok"]."
".$lang_label["down"].": ".$grupo[$real_count]["down"]."
".$lang_label["fail"].": ".$grupo[$real_count]["bad"]."
-


".$icono_type."

".$group_name.""; + "; + // Render network exec module button, only when this group is writtable by user + if (give_acl($id_user, $grupo[$real_count]["id_grupo"], "AW")==1){ + $celda = $celda . ""; + } + $celda = "
".$celda."

".$icono_type."

".$group_name.""; + $celda = $celda.""; + $celda = $celda.""; + $celda = $celda.""; + $celda = $celda.""; + $celda = $celda.""; + $celda = $celda.""; + $celda = $celda.""; + $celda = $celda."
".$lang_label["agents"].":
".$grupo[$real_count]["agent"].""; + $celda = $celda."
".ucfirst($lang_label["monitors"]).":
".$lang_label["ok"].": ".$grupo[$real_count]["ok"]."
".$lang_label["down"].": ".$grupo[$real_count]["down"]."
".$lang_label["fail"].": ".$grupo[$real_count]["bad"]."
"; + $celda = $celda."
"; - } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent viewi (Grouped)");