2008-04-10 Sancho Lerena <slerena@artica.es>

* godmode/agentes/alert_manager.php, godmode/agentes/configurar_agente.php,
        godmode/agentes/alert_manager_editor.php: Fixed problem with combined alert
        editor. Tested and works fine for me.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@805 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-04-10 14:00:50 +00:00
parent 494f7f5ff7
commit 4698c1d102
6 changed files with 80 additions and 72 deletions

View File

@ -1,3 +1,9 @@
2008-04-10 Sancho Lerena <slerena@artica.es>
* godmode/agentes/alert_manager.php, godmode/agentes/configurar_agente.php,
godmode/agentes/alert_manager_editor.php: Fixed problem with combined alert
editor. Tested and works fine for me.
2008-04-10 Jorge Gonzalez <jorge.gonzalez@artica.es>
* include/functions_db.php: Added a new function solving the bug

View File

@ -130,70 +130,71 @@ echo "<h3>".lang_string("combined alerts")."</h3>";
$sql1='SELECT * FROM talerta_agente_modulo WHERE id_agent = '.$id_agente;
$result=mysql_query($sql1);
if ($row=mysql_num_rows($result)){
$color = 1;
$string = '';
while ($row=mysql_fetch_array($result)){ // All modules of this agent
// Show data for this combined alert
$string = "<tr><td class='datos3'>";
$string .= lang_string("Combined")." #".$row["id_aam"];
$string .= show_alert_row_edit ($row, "datos3", 0, 1);
$string .= '<td class="datos3">'; // action
if (give_acl($id_user, $id_grupo, "LW")==1){
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&delete_alert=".$row["id_aam"]."'> <img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&form_alerttype=combined&update_alert=".$row["id_aam"]."'>
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
if (mysql_num_rows($result) == 0){
echo "<div class='nf'>".$lang_label["no_modules"]."</div>";
} else {
$color = 1;
$string = "";
while ($row=mysql_fetch_array($result)){
// Show data for this combined alert
$string .= "<tr><td class='datos3'>";
$string .= lang_string("Combined")." #".$row["id_aam"];
$string .= show_alert_row_edit ($row, "datos3", 0, 1);
$string .= '<td class="datos3">'; // action
if (give_acl($id_user, $id_grupo, "LW")==1){
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&delete_alert=".$row["id_aam"]."'> <img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&form_alerttype=combined&update_alert=".$row["id_aam"]."'>
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
}
$id_aam = $row["id_aam"];
$sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam";
$result2=mysql_query($sql2);
while ($row2=mysql_fetch_array($result2)){
// Show data for each component of this combined alert
if ($color == 1){
$tdcolor="datos";
$color =0;
} else {
$tdcolor="datos2";
$color =1;
}
$id_aam = $row["id_aam"];
$sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam";
$result2=mysql_query($sql2);
while ($row2=mysql_fetch_array($result2)){
// Show data for each component of this combined alert
if ($color == 1){
$tdcolor="datos";
$color =0;
} else {
$tdcolor="datos2";
$color =1;
}
$module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]);
$description = $row2["descripcion"];
$alert_mode = $row2["operation"];
$id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]);
$string = $string."<tr style='color: #666;'><td class='$tdcolor'><a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$module["id_agente"]."'><b>".$id_agente_name." </b>- ".substr($module["nombre"],0,15)."</A>";
$string .= show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1);
$module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]);
$description = $row2["descripcion"];
$alert_mode = $row2["operation"];
$id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]);
$string .= "<tr style='color: #666;'><td class='$tdcolor'><a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$module["id_agente"]."'><b>".$id_agente_name." </b>- ".substr($module["nombre"],0,15)."</A>";
$string .= show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1);
$string = $string."</td><td class='$tdcolor'>";
$id_grupo = dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "LW")==1){
$string = $string."<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&delete_alert_comp=".$row2["id_aam"]."'> <img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string = $string."<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&update_alert=".$row2["id_aam"]."'>
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
}
$string = $string."</td>";
$string .= "</td><td class='$tdcolor'>";
$id_grupo = dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "LW")==1){
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&delete_alert_comp=".$row2["id_aam"]."'> <img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&update_alert=".$row2["id_aam"]."'>
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
}
$string .= "</td>";
}
if (isset($string) & $string!='') {
echo "<table cellpadding='4' cellspacing='4' width='750' class='databox'>
<tr><th>".$lang_label["name"]."</th>
<th>".$lang_label["type"]."</th>
<th>".lang_string ("Oper")."</th>
<th>".$lang_label["threshold"]."</th>
<th>".$lang_label["min."]."</th>
<th>".$lang_label["max."]."</th>
<th>".$lang_label["time"]."</th>
<th>".$lang_label["description"]."</th>
<th>".lang_string ("info")."</th>
<th width='50'>".$lang_label["action"]."</th></tr>";
echo $string;
echo "</table>";
} else {
echo "<div class='nf'>".$lang_label["no_alerts"]."</div>";
}
} else {
echo "<div class='nf'>".$lang_label["no_modules"]."</div>";
}
if (isset($string) & $string != "") {
echo "<table cellpadding='4' cellspacing='4' width='750' class='databox'>
<tr><th>".$lang_label["name"]."</th>
<th>".$lang_label["type"]."</th>
<th>".lang_string ("Oper")."</th>
<th>".$lang_label["threshold"]."</th>
<th>".$lang_label["min."]."</th>
<th>".$lang_label["max."]."</th>
<th>".$lang_label["time"]."</th>
<th>".$lang_label["description"]."</th>
<th>".lang_string ("info")."</th>
<th width='50'>".$lang_label["action"]."</th></tr>";
echo $string;
echo "</table>";
} else {
echo "<div class='nf'>".$lang_label["no_alerts"]."</div>";
}
}
?>

View File

@ -60,8 +60,7 @@ if ($form_alerttype != "combined"){
}
echo "</select>";
} else {
$agentmodule_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $alerta_id_agentemodulo);
echo "DEBUG $alerta_id_agentemodulo";
$agentmodule_name = get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = $alerta_id_agentemodulo");
echo $agentmodule_name;
}
} else {
@ -267,11 +266,11 @@ echo lang_string ("Alert recovery");
echo "<td class='datos2'>";
echo '<select name="alert_recovery">';
if ((isset($alert_recovery)) AND ($alert_recovery == "1")) {
echo "<option value='1'>".$lang_label["disabled"];
echo "<option value='0'>".$lang_label["enabled"];
echo "<option value='1'>".$lang_label["enabled"];
echo "<option value='0'>".$lang_label["disabled"];
} else {
echo "<option value='0'>".$lang_label["enabled"];
echo "<option value='1'>".$lang_label["disabled"];
echo "<option value='0'>".$lang_label["disabled"];
echo "<option value='1'>".$lang_label["enabled"];
}
echo "</select>";

View File

@ -263,6 +263,8 @@ if (isset($_GET["delete_alert_comp"])){ // if modified some parameter
// =============
if (isset($_POST["insert_alert"])){ // if created alert
$combined = get_parameter ("combined",0);
$id_agente_modulo = get_parameter ("agente_modulo",0);
$maximo = get_parameter ("maximo",0);
$minimo = get_parameter ("minimo",0);
@ -291,7 +293,7 @@ if (isset($_POST["insert_alert"])){ // if created alert
$campo2_rec = get_parameter ("campo_2_rec","");
$campo3_rec = get_parameter ("campo_3_rec","");
if ((isset($combined)) AND ($combined == 1))
if ($combined == 1)
$alert_id_agent = $id_agente;
else
$alert_id_agent = 0;

View File

@ -2,10 +2,10 @@
// Begin of automatic config file
$config["dbname"]="pandora"; // MySQL DataBase name
$config["dbuser"]="pandora"; // DB User
$config["dbpass"]="iysukzjq"; // DB Password
$config["dbpass"]="pandora"; // DB Password
$config["dbhost"]="localhost"; // DB Host
$config["homedir"]="/var/www/pandora/"; // Config homedir
$config["homeurl"]="http://localhost/pandora"; // Base URL
$config["homedir"]="/var/www/pandora_console/"; // Config homedir
$config["homeurl"]="http://localhost/pandora_console"; // Base URL
// End of automatic config file
?><?php
// Pandora FMS - the Free Monitoring System
@ -37,10 +37,10 @@ $config["homeurl"]="http://localhost/pandora"; // Base URL
// $config["homeurl"]="/pandora_console/";
// Do not display any ERROR
//error_reporting(0); // Need to use active console at this moment
// error_reporting(0); // Need to use active console at this moment
// Display ALL errors
error_reporting(E_ERROR);
error_reporting(1);
// This is directory where placed "/attachment" directory, to upload files stores.
// This MUST be writtable by http server user, and should be in pandora root.

View File

@ -212,7 +212,7 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
<div id="menu">
<?php require ("general/main_menu.php"); ?>
</div>
<div id="main" style="background: url(images/backgrounds/<?php echo $config_bgimage; ?>)" >
<div id="main">
<?php
// Page loader / selector
if ($pagina != ""){