- Solve small bug not showing one group if n=3 in estado_grupo.php (Pandora Console)

- Change order of verifing if the var SNMP_OID is set in configurar_agente.php (Pandora Console)
- Change AND to OR for verifing if the two SQL inserts were OK while inserting new monitor in configurar_agente.php (Pandora Console)

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@110 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2006-07-09 00:33:33 +00:00
parent c02a36c511
commit f671a9fda8
2 changed files with 29 additions and 15 deletions

View File

@ -1,4 +1,4 @@
<?PHP
<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
@ -234,7 +234,9 @@ if (give_acl($id_user, 0, "AW")==1) {
if (isset($_POST["update_alert"])){ // Update an existing alert
$id_aam = entrada_limpia($_POST["id_aam"]);
$tipo_alerta = entrada_limpia($_POST["tipo_alerta"]);
if (isset($_POST["agente_modulo"])) $id_agente_modulo = entrada_limpia($_POST["agente_modulo"]);
if (isset($_POST["agente_modulo"])) {
$id_agente_modulo = entrada_limpia($_POST["agente_modulo"]);
}
$descripcion= entrada_limpia($_POST["descripcion"]);
$campo_1 = entrada_limpia($_POST["campo_1"]);
$campo_2 = entrada_limpia($_POST["campo_2"]);
@ -501,14 +503,15 @@ if (give_acl($id_user, 0, "AW")==1) {
// =========================================================
// MODULE INSERT
// =========================================================
if ((!isset($_POST["oid"])) && (isset($_POST["insert_module"])) && (isset($_POST["combo_snmp_oid"]))){
$combo_snmp_oid = entrada_limpia($_POST["combo_snmp_oid"]);
if ((!isset($_POST["oid"])) && (isset($_POST["insert_module"]))){
if (isset($_POST["combo_snmp_oid"])) {
$combo_snmp_oid = entrada_limpia($_POST["combo_snmp_oid"]);
}
if ($snmp_oid == ""){
$snmp_oid = $combo_snmp_oid;
}
$sql_insert = "INSERT INTO tagente_modulo (id_agente,id_tipo_modulo,nombre,descripcion,max,min,snmp_oid,snmp_community,id_module_group,module_interval,ip_target,tcp_port,tcp_rcv,tcp_send) VALUES (".$id_agente.",".$id_tipo_modulo.",'".$nombre."','".$descripcion."','".$modulo_max."','".$modulo_min."', '$snmp_oid', '$snmp_community', '$id_module_group', '$module_interval', '$ip_target', '$tcp_port', '$tcp_rcv', '$tcp_send' )";
$sql_insert = "INSERT INTO tagente_modulo (id_agente,id_tipo_modulo,nombre,descripcion,max,min,snmp_oid,snmp_community,id_module_group,module_interval,ip_target,tcp_port,tcp_rcv,tcp_send) VALUES (".$id_agente.",".$id_tipo_modulo.",'".$nombre."','".$descripcion."','".$modulo_max."','".$modulo_min."', '$snmp_oid', '$snmp_community', '$id_module_group', '$module_interval', '$ip_target', '$tcp_port', '$tcp_rcv', '$tcp_send')";
// Init vars to null to avoid trash in forms
$id_tipo_modulo = "";$nombre = "";$descripcion = "";$modulo_max = "";
$modulo_min = "";// Pandora 1.2 new module data:
@ -516,7 +519,7 @@ if (give_acl($id_user, 0, "AW")==1) {
$snmp_oid = "";$snmp_community = "";$id_module_group = "";
$module_interval = "";
// echo "DEBUG ".$sql_insert;
//echo "DEBUG ".$sql_insert;
$result=mysql_query($sql_insert);
$id_agente_modulo = mysql_insert_id();
// Create with different estado if proc type or data type
@ -526,7 +529,7 @@ if (give_acl($id_user, 0, "AW")==1) {
$sql_insert = "INSERT INTO tagente_estado (id_agente_modulo,datos,timestamp,cambio,estado,id_agente) VALUES ($id_agente_modulo, 0,'2000-00-00 00:00:00',0,100,'".$id_agente."')";
}
$result2=mysql_query($sql_insert);
if ((! $result) && (! $result2))
if ((! $result) || (! $result2))
echo "<h3 class='error'>".$lang_label["add_module_no"]."</h3>";
else
echo "<h3 class='suc'>".$lang_label["add_module_ok"]."</h3>";

View File

@ -1,10 +1,21 @@
<?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
// Raúl Mateos <raulofpandora@gmail.com>, 2005-2006
// 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");
@ -26,7 +37,7 @@ if (comprueba_login() == 0)
// 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"];
$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"];
@ -114,7 +125,7 @@ if (comprueba_login() == 0)
$ancho = ceil(sqrt($array_index+1));
$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 "<table border=0 cellpadding=10 cellspacing=10>";
for ($table=0;$table < $ancho-1;$table++){
for ($table=0;$table < $ancho;$table++){
echo "<tr class='bot'>";
for ($table_row=0;$table_row < $ancho;$table_row++){
if ($real_count < $array_index){