2007-04-22 slerena <slerena@artica.es>

* functions_db.php, language_en.php, estado_grupo.php
	estado_agente.php configurar_grupo.php lista_grupos.php
	modificar_server.php: New feature implemented: groups could be
	configured to do not launch alerts (Disabled field). Any agent
	inside this group does not fire alerts while disabled will be
	activated. Useful for programmed non-service periods or programmed
	shutdowns.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@441 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-04-22 01:08:58 +00:00
parent c6b4812814
commit 966a8bd143
8 changed files with 86 additions and 16 deletions

View File

@ -1,3 +1,14 @@
2007-04-22 Sancho Lerena <slerena@artica.es>
* functions_db.php, language_en.php, estado_grupo.php
estado_agente.php configurar_grupo.php lista_grupos.php
modificar_server.php: New feature implemented: groups could be
configured to do not launch alerts (Disabled field). Any agent
inside this group does not fire alerts while disabled will be
activated. Useful for programmed non-service periods or programmed
shutdowns.
2007-04-21 Sancho Lerena <slerena@gmail.com>
* include/languages/language_en.php: New strings added.

View File

@ -31,6 +31,7 @@ if (comprueba_login() == 0)
$id_grupo = "";
$nombre = "";
$id_parent = "";
$disabled = 0;
if (isset($_GET["creacion_grupo"])){ //
$creacion_grupo = entrada_limpia($_GET["creacion_grupo"]);
@ -45,6 +46,7 @@ if (comprueba_login() == 0)
if ($row=mysql_fetch_array($result)){
$nombre = $row["nombre"];
$icono = $row["icon"];
$disabled = $row["disabled"];
$id_parent = entrada_limpia($row["parent"]);
} else
{
@ -73,7 +75,7 @@ sec2=godmode/grupos/lista_grupos">
echo "<input type='hidden' name='id_grupo' value='".$id_grupo."'>";
}
?>
<tr><td class='lb' rowspan='4' width='5'>
<tr><td class='lb' rowspan='5' width='3'>
<tr><td class="datos"><?php echo $lang_label["group_name"] ?></td>
<td class="datos">
<input type="text" name="nombre" size="35" value="<?php echo $nombre ?>">
@ -116,6 +118,22 @@ sec2=godmode/grupos/lista_grupos">
}
echo '</select>';
// Disabled
echo "<tr><td class='datos2'>";
echo $lang_label["alerts"];
echo '<td class="datos2">';
echo '<select name="disabled">';
if ($disabled == 1){
echo "<option value=1>".$lang_label["disabled"];
echo "<option value=0>".$lang_label["enabled"];
} else {
echo "<option value=0>".$lang_label["enabled"];
echo "<option value=1>".$lang_label["disabled"];
}
echo "</select>";
echo "<tr><td colspan='3'><div class='raya'></div></td></tr>";
echo '<tr><td colspan="3" align="right">';
if (isset($_GET["creacion_grupo"]))

View File

@ -32,8 +32,9 @@ if (comprueba_login() == 0)
$nombre = entrada_limpia($_POST["nombre"]);
$icon = entrada_limpia($_POST["icon"]);
$parent = entrada_limpia($_POST["parent"]);
$sql_insert="INSERT INTO tgrupo (nombre, icon, parent)
VALUES ('$nombre', '$icon', '$parent') ";
$disabled = entrada_limpia($_POST["disabled"]);
$sql_insert="INSERT INTO tgrupo (nombre, icon, parent, disabled)
VALUES ('$nombre', '$icon', '$parent', $disabled) ";
$result=mysql_query($sql_insert);
if (! $result)
echo "<h3 class='error'>".$lang_label["create_group_no"]."</h3>";
@ -47,9 +48,10 @@ if (comprueba_login() == 0)
$nombre = entrada_limpia($_POST["nombre"]);
$id_grupo = entrada_limpia($_POST["id_grupo"]);
$icon = entrada_limpia($_POST["icon"]);
$disabled = entrada_limpia($_POST["disabled"]);
$parent = entrada_limpia($_POST["parent"]);
$sql_update ="UPDATE tgrupo
SET nombre = '$nombre', icon = '$icon', parent = '$parent'
SET nombre = '$nombre', icon = '$icon', disabled = $disabled, parent = '$parent'
WHERE id_grupo = '$id_grupo'";
$result=mysql_query($sql_update);
if (! $result)
@ -80,6 +82,7 @@ if (comprueba_login() == 0)
echo "<th>".$lang_label["icon"]."</th>";
echo "<th>".$lang_label["group_name"]."</th>";
echo "<th>".$lang_label["parent"]."</th>";
echo "<th>".$lang_label["alerts"]."</th>";
echo "<th>".$lang_label["delete"]."</th>";
$sql1='SELECT * FROM tgrupo ORDER BY nombre';
$result=mysql_query($sql1);
@ -103,14 +106,23 @@ if (comprueba_login() == 0)
echo "<td class='$tdcolor'>";
echo dame_nombre_grupo ($row["parent"]);
echo "</td>";
// Disabled?
echo "<td class='$tdcolor' align='center'>";
if ($row["disabled"]==1)
echo "<img src='images/flag_red.png'> ".$lang_label["disabled"];
else
echo "<img src='images/flag_green.png'> ".$lang_label["enabled"];
echo "</td>";
echo "<td class='$tdcolor' align='center'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/grupos/lista_grupos&id_grupo=".$row["id_grupo"]."&borrar_grupo=".$row["id_grupo"]."'";
echo ' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
echo "<img border='0' src='images/cross.png'></a></td></tr>";
}
}
echo "<tr><td colspan='4'><div class='raya'></div></td></tr>";
echo "<tr><td colspan='4' align='right'>";
echo "<tr><td colspan='5'><div class='raya'></div></td></tr>";
echo "<tr><td colspan='5' align='right'>";
echo "<form method=post action='index.php?sec=gagente&
sec2=godmode/grupos/configurar_grupo&creacion_grupo=1'>";
echo "<input type='submit' class='sub next' name='crt' value='".$lang_label["create_group"]."'>";

View File

@ -69,8 +69,8 @@ if (comprueba_login() == 0) {
echo '<form name="servers" method="POST" action="index.php?sec=gserver&sec2=godmode/servers/modificar_server&update=1">';
echo "<table cellpadding='3' cellspacing='3' width='450'>";
echo "<tr><td class='lb' rowspan='3' width='5'>";
echo "<td class='datos'>".$lang_label["name"]."</td><td class='datos'><input type='text' name='name' value='".$name."' width="200px">";
echo "<tr><td class='datos2'>".$lang_label['ip_address']."</td><td class='datos2'><input type='text' name='address' value='".$address."' width="200px">";
echo "<td class='datos'>".$lang_label["name"]."</td><td class='datos'><input type='text' name='name' value='".$name."' width='200px'>";
echo "<tr><td class='datos2'>".$lang_label['ip_address']."</td><td class='datos2'><input type='text' name='address' value='".$address."' width='200px'>";
echo "<tr><td class='datos'>".$lang_label['description']."<td class='datos'><input type='text' name='description' value='".$description."'><input type='hidden' name='server' value='".entrada_limpia($_GET["server"])."'></input>";
}
else {
@ -173,4 +173,4 @@ if (comprueba_login() == 0) {
require ("general/noaccess.php");
}
}
?>
?>

View File

@ -135,6 +135,22 @@ function dame_perfil($id){
return $cat;
}
// ---------------------------------------------------------------
// Returns disabled from a given group_id
// ---------------------------------------------------------------
function give_disabled_group($id){
require("config.php");
$query1="SELECT * FROM tgrupo WHERE id_grupo =".$id;
$resq1=mysql_query($query1);
if ($rowdup=mysql_fetch_array($resq1)){
$cat=$rowdup["disabled"];
}
else $cat = "";
return $cat;
}
// ---------------------------------------------------------------
// Returns group given ID

View File

@ -766,7 +766,7 @@ $lang_label["custom_reporting"]="Custom reporting";
$lang_label["alert_text"]="Alert text";
$lang_label["text"]="Text";
$lang_label["delete_data_above"]="Delete data above";
$lang_label["enabled"]="Enabled";

View File

@ -213,6 +213,7 @@ if (comprueba_login() == 0) {
echo "&nbsp;<a href='index.php?sec=estado&amp;
sec2=operation/agentes/ver_agente&amp;id_agente=".$id_agente."'>
<b>".$nombre_agente."</b></a></td>";
// Show SO icon :)
echo "<td class='$tdcolor' align='center'>
<img border=0 src='images/".dame_so_icon($id_os)."'
@ -224,8 +225,13 @@ if (comprueba_login() == 0) {
} else {
echo "<td class='$tdcolor'>".$intervalo."</td>";
}
// Show GROUP icon
echo '<td class="'.$tdcolor.'" align="center">
<img src="images/groups_small/'.show_icon_group($id_grupo).'.png" title="'.dame_grupo($id_grupo).'"></td>';
<img src="images/groups_small/'.show_icon_group($id_grupo).'.png" title="'.dame_grupo($id_grupo).'">';
echo '</td>';
echo "<td class='$tdcolor'> ".
$numero_modulos." <b>/</b> ".$numero_monitor;
if ($monitor_bad <> 0) {
@ -257,11 +263,14 @@ if (comprueba_login() == 0) {
// checks if an alert was fired recently
echo "<td class='$tdcolor' align='center'>";
if (check_alert_fired($id_agente) == 1)
echo "<img src='images/dot_red.gif'>";
else
echo "<img src='images/dot_green.gif'>";
if (give_disabled_group($id_grupo) == 1)
echo "&nbsp;<img src='images/flag_red.png' alt='".$lang_label["disabled"]."'>";
else {
if (check_alert_fired($id_agente) == 1)
echo "<img src='images/dot_red.gif'>";
else
echo "<img src='images/dot_green.gif'>";
}
echo "</td>";
echo "<td class='$tdcolor'>";
if ( $ultimo_contacto == "0000-00-00 00:00:00"){

View File

@ -159,6 +159,10 @@
$icono_type=$icono_type."
<img src='images/dot_white.gif' alt=''>";
}
// Show red flag is group has disabled alert system
if (give_disabled_group($grupo[$real_count]["id_grupo"]) == 1)
$icono_type = $icono_type."&nbsp;<img src='images/flag_red.png' alt='".$lang_label["disabled"]."'>";
// By default green border
$celda = "<td class='top' style='border: 3px solid #AEFF21;' width='100'>";