2007-01-01 Raul Mateos <raulofpandora@gmail.com>
* include/functions_db.php: Add new function to obtain group list. * godmode/alertas/configurar_alerta.php: Clear code. Clear sytle. * operation/agentes/estado_grupo: Clear code. Clear style. Use new list_group2 function. Simplify SQL queries. * operation/events/events.php: Clear code. Clear style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@345 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
fe14f7964c
commit
42402f6416
|
@ -1,3 +1,14 @@
|
|||
2007-01-01 Raul Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* include/functions_db.php: Add new function to obtain group list.
|
||||
|
||||
* godmode/alertas/configurar_alerta.php: Clear code. Clear sytle.
|
||||
|
||||
* operation/agentes/estado_grupo: Clear code. Clear style. Use new
|
||||
list_group2 function. Simplify SQL queries.
|
||||
|
||||
* operation/events/events.php: Clear code. Clear style.
|
||||
|
||||
2006-12-31 Raul Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* include/functions.php, functions_db.php: Move list_group from f*.php
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
<?php
|
||||
// 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
|
||||
// Raul Mateos <raulofpandora@gmail.com>, 2005-2006
|
||||
|
||||
// Cargamos variables globales
|
||||
// Pandora - the Free monitoring system
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas 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 ( (give_acl($id_user, 0, "LM")==1)){
|
||||
// Var init
|
||||
|
@ -32,16 +44,21 @@ if ( (give_acl($id_user, 0, "LM")==1)){
|
|||
|
||||
$creacion_alerta = 0;
|
||||
if (isset($_GET["creacion"])){
|
||||
// Conecto con la BBDD
|
||||
$creacion_alerta = 1;
|
||||
|
||||
// Codigo de creacion de la alerta
|
||||
}
|
||||
|
||||
echo "<h2>".$lang_label["alert_config"]."</h2>";
|
||||
echo "<h3>";
|
||||
if (isset($_GET["creacion"])){
|
||||
echo $lang_label["create_alert"];
|
||||
}
|
||||
if (isset($_GET["id_alerta"])){
|
||||
echo $lang_label["mod_alert"];
|
||||
}
|
||||
echo '<a href="help/'.$help_code.'/chap3.php#3221" target="_help" class="help">
|
||||
<span>'.$lang_label["help"].'</span></a>';
|
||||
echo "</h3>";
|
||||
?>
|
||||
<h2><?php echo $lang_label["alert_config"];?></h2>
|
||||
<h3><?php if (isset($_GET["creacion"])){echo $lang_label["create_alert"];} if (isset($_GET["id_alerta"])){echo $lang_label["mod_alert"];} ?><a href="help/<?php echo $help_code;?>/chap3.php#3221" target="_help" class="help"> <span><?php echo $lang_label["help"];?></span></a></h3>
|
||||
|
||||
<table width="500" cellspacing="3" cellpadding="3">
|
||||
|
||||
<form name="alerta" method="post" action="index.php?sec=galertas&sec2=godmode/alertas/modificar_alerta&id_alerta=<?php echo $id_alerta ?>">
|
||||
|
@ -77,8 +94,12 @@ _data_<br>
|
|||
</textarea>
|
||||
<tr><td colspan='3'><div class='raya'></div></td></tr>
|
||||
<tr><td colspan="3" align="right">
|
||||
<?php if (isset($_GET["creacion"])){echo "<input name='crtbutton' type='submit' class='sub' value='".$lang_label["create"]."'>";}
|
||||
else {echo "<input name='uptbutton' type='submit' class='sub' value='".$lang_label["update"]."'>";} ?>
|
||||
<?php
|
||||
if (isset($_GET["creacion"])){
|
||||
echo "<input name='crtbutton' type='submit' class='sub' value='".$lang_label["create"]."'>";
|
||||
} else {
|
||||
echo "<input name='uptbutton' type='submit' class='sub' value='".$lang_label["update"]."'>";
|
||||
} ?>
|
||||
</form>
|
||||
|
||||
</table>
|
||||
|
|
|
@ -595,6 +595,25 @@ function list_group ($id_user){
|
|||
return ($mis_grupos);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Defines an array
|
||||
// to put all groups with Agent Read permission
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
function list_group2 ($id_user){
|
||||
$mis_grupos[]=""; // Define array mis_grupos to put here all groups with Agent Read permission
|
||||
$sql='SELECT id_grupo FROM tgrupo';
|
||||
$result=mysql_query($sql);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($row["id_grupo"] != 1){
|
||||
if (give_acl($id_user,$row["id_grupo"], "AR") == 1){
|
||||
$mis_grupos[]=$row["id_grupo"]; //Put in an array all the groups the user belongs
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($mis_grupos);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Return Group iconname given its name
|
||||
// ---------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
// Pandora - the Free Distributed Monitoring System
|
||||
// Pandora - the Free Monitoring System
|
||||
// ================================================
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
|
||||
|
@ -23,18 +23,12 @@ require("include/config.php");
|
|||
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"]."<a href='help/".$help_code."/chap3.php#324' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
||||
$iduser_temp = $_SESSION['id_usuario'];
|
||||
echo "<h3>".$lang_label["group_view"]."
|
||||
<a href='help/".$help_code."/chap3.php#324' target='_help' class='help'>
|
||||
<span>".$lang_label["help"]."</span>
|
||||
</a></h3>";
|
||||
|
||||
$sql1 = 'SELECT * FROM tgrupo';
|
||||
$result2 = mysql_query ($sql1);
|
||||
if (mysql_num_rows ($result2)) {
|
||||
while ($row = mysql_fetch_array ($result2)) {
|
||||
if ($row["id_grupo"] != 1 &&
|
||||
give_acl($iduser_temp,$row["id_grupo"], "AR") == 1) {
|
||||
$mis_grupos[]=$row["id_grupo"]; //All my groups in an array
|
||||
}
|
||||
}
|
||||
$mis_grupos=list_group2 ($id_user);
|
||||
|
||||
// Update network modules for this group
|
||||
// Check for Network FLAG change request
|
||||
|
@ -69,7 +63,8 @@ if (comprueba_login () == 0) {
|
|||
$grupo[$array_index]["id_grupo"] = $migrupo;
|
||||
$existen_agentes =0;
|
||||
|
||||
$sql1 = "SELECT * FROM tagente WHERE disabled=0
|
||||
$sql1 = "SELECT intervalo, id_agente
|
||||
FROM tagente WHERE disabled=0
|
||||
AND id_grupo =".$migrupo;
|
||||
if ($result1 = mysql_query ($sql1)) {
|
||||
while ($row1 = mysql_fetch_array ($result1)) {
|
||||
|
@ -86,13 +81,17 @@ if (comprueba_login () == 0) {
|
|||
$grupo[$array_index]["group"] = dame_nombre_grupo ($migrupo);
|
||||
// Estado grupo, agent
|
||||
$contador_agente++;
|
||||
$sql3 = "SELECT * FROM tagente_estado WHERE id_agente = ".$row1["id_agente"];
|
||||
$sql3 = "SELECT estado, timestamp, id_agente_modulo,
|
||||
datos FROM tagente_estado
|
||||
WHERE id_agente = ".$row1["id_agente"];
|
||||
$result3 = mysql_query ($sql3);
|
||||
while ($row3 = mysql_fetch_array ($result3)) {
|
||||
$estado = $row3["estado"];
|
||||
// Get module interval
|
||||
$ahora = date ("Y/m/d H:i:s");
|
||||
$sql4 = "SELECT * FROM tagente_modulo WHERE id_agente_modulo = ".$row3["id_agente_modulo"];
|
||||
$sql4 = "SELECT module_interval
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = ".$row3["id_agente_modulo"];
|
||||
$result4 = mysql_query ($sql4);
|
||||
if ($row4 = mysql_fetch_array ($result4)) {
|
||||
$module_interval = $row4["module_interval"];
|
||||
|
@ -107,7 +106,8 @@ if (comprueba_login () == 0) {
|
|||
|
||||
// Defines if module is down (interval x 2 > time last contact)
|
||||
if ($ultimo_contacto_modulo != "0000-00-00 00:00:00") {
|
||||
$seconds = strtotime ($ahora) - strtotime ($ultimo_contacto_modulo);
|
||||
$seconds = strtotime ($ahora) -
|
||||
strtotime ($ultimo_contacto_modulo);
|
||||
if ($seconds >= ($intervalo_comp * 2)) {
|
||||
$grupo[$array_index]["down"]++;
|
||||
} elseif ($estado != 100) {
|
||||
|
@ -220,7 +220,7 @@ if (comprueba_login () == 0) {
|
|||
</span></a>";
|
||||
// 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 .= "<a href='index.php?
|
||||
$celda .= " <a href='index.php?
|
||||
sec=estado&
|
||||
sec2=operation/agentes/estado_grupo&
|
||||
update_netgroup=".$grupo[$real_count]["id_grupo"]."'>
|
||||
|
@ -248,5 +248,5 @@ if (comprueba_login () == 0) {
|
|||
"Trying to access Agent view (Grouped)");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -64,9 +64,12 @@ if (comprueba_login() == 0) {
|
|||
if (give_acl($id_user, $id_group, "IM") ==1){
|
||||
$sql2="DELETE FROM tevento WHERE id_evento =".$id_evento;
|
||||
$result2=mysql_query($sql2);
|
||||
if ($result) {echo "<h3 class='suc'>".$lang_label["delete_event_ok"]."</h3>";}
|
||||
if ($result) {
|
||||
echo "<h3 class='suc'>".$lang_label["delete_event_ok"]."</h3>";
|
||||
}
|
||||
} else {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to delete event ID".$id_evento);
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to delete event ID".$id_evento);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +124,6 @@ if (comprueba_login() == 0) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
echo "<h2>".$lang_label["events"]."</h2>";
|
||||
echo "<h3>".$lang_label["event_main_view"]."<a href='help/".$help_code."/chap5.php#5' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
||||
echo "<table cellpadding='3' cellspacing='3'><tr>";
|
||||
|
|
Loading…
Reference in New Issue