- New icon for unknown agent status, and single data (not monitor data). Fixed width in group view and finished code for detailed info in hint.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@66 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2006-06-29 22:28:49 +00:00
parent 52765cfa4e
commit 42af52117f
3 changed files with 30 additions and 51 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 196 B

View File

@ -1,20 +1,10 @@
<?php
// 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.
// Pandora - The Free Monitoring System
// This code is protected by GPL license.
// Este codigo esta protegido por la licencia GPL.
// Sancho Lerena <slerena@gmail.com>, 2003-2006
// Raúl Mateos <raulofpandora@gmail.com>, 2005-2006
// Load global vars
require("include/config.php");
@ -22,21 +12,8 @@ if (comprueba_login() == 0)
if (give_acl($id_user, 0, "AR")==1) {
echo "<h2>".$lang_label["ag_title"]."</h2>";
echo "<h3>".$lang_label["group_view"]."</h3>";
// 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 "<h3 class='suc'>".$lang_label["network_module_refresh_exec"]."</h3>";
}
}
$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)){
@ -49,7 +26,7 @@ if (comprueba_login() == 0)
$array_index = 0;
$estado_grupo_ok =0;
$estado_grupo_down =0;
$estado_grupo_bad =0;
$estado_grupo_bad =0;
// Recorro cada grupo para ver el estado de todos los modulos
foreach ($mis_grupos as $migrupo)
if ($migrupo != "") {
@ -57,6 +34,7 @@ if (comprueba_login() == 0)
$grupo[$array_index]["ok"]=0;
$grupo[$array_index]["down"]=0;
$grupo[$array_index]["bad"]=0;
$grupo[$array_index]["data"]=0;
$grupo[$array_index]["icon"]=dame_grupo_icono($migrupo);
$grupo[$array_index]["id_grupo"]=$migrupo;
$existen_agentes =0;
@ -83,7 +61,7 @@ if (comprueba_login() == 0)
$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 = 9 OR id_tipo_modulo = 12 OR id_tipo_modulo = 18) 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 = 10) 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"];
@ -98,7 +76,17 @@ if (comprueba_login() == 0)
$grupo[$array_index]["bad"]++; // Estado grupo, agent BAD
}
}
$grupo[$array_index]["ok"];
$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"];
$result2=mysql_query($sql2);
while ($row2 = mysql_fetch_array($result2)){
$sql3="SELECT * FROM tagente_estado WHERE id_agente_modulo = ".$row2["id_agente_modulo"];
$result3=mysql_query($sql3);
$row3 = mysql_fetch_array($result3);
if ($row3["datos"] !=0){
$estado_grupo_ok++;
$grupo[$array_index]["data"]++; // Data module
}
}
}
}
if ($existen_agentes == 1){
@ -117,7 +105,7 @@ if (comprueba_login() == 0)
$icono_grupo = $grupo[$real_count]["icon"];
$icono_type="";
if ($grupo[$real_count]["down"]>0) {
$icono_type="<img src='images/dot_white.gif' alt=''>";
$icono_type="<img src='images/dot_down.gif' alt=''>";
}
if ($grupo[$real_count]["bad"]>0) {
$icono_type=$icono_type."<img src='images/dot_red.gif' alt=''>";
@ -125,12 +113,14 @@ if (comprueba_login() == 0)
if ($grupo[$real_count]["ok"]>0) {
$icono_type=$icono_type."<img src='images/dot_green.gif' alt=''>";
}
// Icon with tooltip table inside (Raul)
$celda = "<img class='top' src='images/groups/".$icono_grupo."_1.gif' border='0' alt=''><a href='#' class='tip'>&nbsp;<span>";
$celda = $celda."<table border='0' cellspacing='2' cellpadding='0'>
if ($grupo[$real_count]["data"]>0) {
$icono_type=$icono_type."<img src='images/dot_white.gif' alt=''>";
}
$celda = "<td class='bot' width=100><a href='index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id=".$grupo[$real_count]["id_grupo"]."' class='info'><img class='top' src='images/groups/".$icono_grupo."_1.gif' border='0' alt=''><span>
<table cellspacing='2' cellpadding='0' style='margin-left:20px'>
<tr><td colspan='2' width='91' class='lb'>".$lang_label["agents"].": </td></tr>
<tr><td colspan='2' class='datos' align='center'><b>".$grupo[$real_count]["agent"]."</b></td></tr></table>
<table>
<table cellspacing='2' cellpadding='0' style='margin-left:20px'>
<tr><td colspan='2' width='90' class='lb'>".ucfirst($lang_label["monitors"]).":</td></tr>
<tr><td class='datos'><img src='images/b_green.gif' align='top' alt='' border='0'> ".$lang_label["ok"].": </td><td class='datos'><font class='greenb'>".$grupo[$real_count]["ok"]."</font></td></tr>
<tr><td class='datos'><img src='images/b_down.gif' align='top' alt='' border='0'> ".$lang_label["down"].": </td><td class='datos'><font class='grey'>".$grupo[$real_count]["down"]."</font></td></tr>
@ -140,18 +130,7 @@ if (comprueba_login() == 0)
if (give_acl($id_user, $grupo[$real_count]["id_grupo"], "AW")==1){
$celda = $celda . "<a href='index.php?sec=estado&sec2=operation/agentes/estado_grupo&update_netgroup=".$grupo[$real_count]["id_grupo"]."'><img src='images/target.gif' border=0></a>";
}
$celda = "<td class='bot'><a href='index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id=".$grupo[$real_count]["id_grupo"]."'>".$celda."</a><br><br>".$icono_type."<br><br><font class='gr'>".$group_name."</font>";
$celda = $celda."<table border='0' cellspacing='2' cellpadding='0'>";
$celda = $celda."<tr><td colspan='2' width='90' class='lb'>".$lang_label["agents"].": </td></tr>";
$celda = $celda."<tr><td colspan='2' class='datos' align='center'><b>".$grupo[$real_count]["agent"]."</b>";
$celda = $celda."<tr><td colspan='2' class='lb'>".ucfirst($lang_label["monitors"]).":</td></tr>";
$celda = $celda."<tr><td class='datos'><img src='images/b_green.gif' align='top' alt=''> ".$lang_label["ok"].": </td><td class='datos'><font class='greenb'>".$grupo[$real_count]["ok"]."</font></td></tr>";
$celda = $celda."<tr><td class='datos'><img src='images/b_down.gif' align='top' alt=''> ".$lang_label["down"].": </td><td class='datos'><font class='grey'>".$grupo[$real_count]["down"]."</font></td></tr>";
$celda = $celda."<tr><td class='datos'><img src='images/b_red.gif' align='top' alt=''> ".$lang_label["fail"].": </td><td class='datos'><font class='redb'>".$grupo[$real_count]["bad"]."</font></td></tr>";
$celda = $celda."<tr><td colspan='2'><div class='raya'></div></td></tr>";
$celda = $celda."</table>";
$celda = $celda."</td>";
$celda = $celda . "<br><br>".$icono_type."<br><br><font class='gr'>".$group_name."</font>";
echo $celda;
}
$real_count++;
@ -161,7 +140,7 @@ if (comprueba_login() == 0)
echo "</table>";
}
else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent viewi (Grouped)");
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent view (Grouped)");
require ("general/noaccess.php");
}
?>