diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 3ae840daeb..51335058d2 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -27,6 +27,9 @@ function type_change() document.modulo.snmp_oid.disabled=true; document.modulo.snmp_community.style.background="#ddd"; document.modulo.snmp_community.disabled=true; + document.modulo.combo_snmp_oid.style.background="#ddd"; + document.modulo.combo_snmp_oid.disabled=true; + document.modulo.oid.disabled=true; document.modulo.tcp_send.style.background="#ddd"; document.modulo.tcp_send.disabled=true; document.modulo.tcp_rcv.style.background="#ddd"; @@ -46,6 +49,9 @@ function type_change() document.modulo.snmp_oid.style.disabled=false; document.modulo.snmp_community.style.background="#fff"; document.modulo.snmp_community.disabled=false; + document.modulo.combo_snmp_oid.style.background="#fff"; + document.modulo.combo_snmp_oid.disabled=false; + document.modulo.oid.disabled=false; document.modulo.tcp_send.style.background="#ddd"; document.modulo.tcp_send.disabled=true; document.modulo.tcp_rcv.style.background="#ddd"; @@ -72,6 +78,9 @@ function type_change() document.modulo.snmp_oid.disabled=true; document.modulo.snmp_community.style.background="#ddd"; document.modulo.snmp_community.disabled=true; + document.modulo.combo_snmp_oid.style.background="#ddd"; + document.modulo.combo_snmp_oid.disabled=true; + document.modulo.oid.disabled=true; document.modulo.tcp_send.style.background="#ddd"; document.modulo.tcp_send.disabled=true; document.modulo.tcp_rcv.style.background="#ddd"; @@ -91,6 +100,9 @@ function type_change() document.modulo.snmp_oid.disabled=true; document.modulo.snmp_community.style.background="#ddd"; document.modulo.snmp_community.disabled=true; + document.modulo.combo_snmp_oid.style.background="#ddd"; + document.modulo.combo_snmp_oid.disabled=true; + document.modulo.oid.disabled=true; document.modulo.tcp_send.style.background="#fff"; document.modulo.tcp_send.disabled=false; document.modulo.tcp_rcv.style.background="#fff"; @@ -111,10 +123,15 @@ function type_change() document.modulo.snmp_oid.disabled=true; document.modulo.snmp_community.style.background="#ddd"; document.modulo.snmp_community.disabled=true; + document.modulo.oid.disabled=true; document.modulo.tcp_send.style.background="#fff"; + document.modulo.tcp_send.disabled=false; document.modulo.tcp_rcv.style.background="#fff"; + document.modulo.tcp_rcv.disabled=false; document.modulo.tcp_port.style.background="#fff"; + document.modulo.tcp_port.disabled=false; document.modulo.ip_target.style.background="#fff"; + document.modulo.ip_target.disabled=false; document.modulo.modulo_max.style.background="#ddd"; document.modulo.modulo_max.disabled=true; document.modulo.modulo_min.style.background="#ddd"; @@ -217,7 +234,7 @@ 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"]); - $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"]); @@ -484,7 +501,7 @@ if (give_acl($id_user, 0, "AW")==1) { // ========================================================= // MODULE INSERT // ========================================================= - if ((!isset($_POST["oid"])) && (isset($_POST["insert_module"]))){ + if ((!isset($_POST["oid"])) && (isset($_POST["insert_module"])) && (isset($_POST["combo_snmp_oid"]))){ $combo_snmp_oid = entrada_limpia($_POST["combo_snmp_oid"]); if ($snmp_oid == ""){ $snmp_oid = $combo_snmp_oid; @@ -738,66 +755,64 @@ if ( $creacion_agente != 1) { $sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'"'; $result=mysql_query($sql1); -if ($row=mysql_num_rows($result)){ -?> -

 

+ if ($row=mysql_num_rows($result)){ - - -"; -}else echo "No modules"; + else echo "".$lang_label["no_modules"].""; ?> -
- - - - - -".$lang_label["assigned_alerts"]." ".$lang_label["help"].""; + + $color=1; + while ($row=mysql_fetch_array($result)){ // All modules of this agent + $id_tipo = $row["id_tipo_modulo"]; + $nombre_modulo =$row["nombre"]; + $sql2='SELECT * FROM ttipo_modulo WHERE id_tipo = "'.$id_tipo.'"'; + $result2=mysql_query($sql2); + $row2=mysql_fetch_array($result2); + //module type modulo is $row2["nombre"]; + + $sql3='SELECT * FROM talerta_agente_modulo WHERE id_agente_modulo = '.$row["id_agente_modulo"]; // From all the alerts give me which are to my agent + $result3=mysql_query($sql3); + while ($row3=mysql_fetch_array($result3)){ + if ($color == 1){ + $tdcolor="datos"; + $color =0; + } else { + $tdcolor="datos2"; + $color =1; + } + $sql4='SELECT * FROM talerta WHERE id_alerta = '.$row3["id_alerta"]; + $result4=mysql_query($sql4); + $row4=mysql_fetch_array($result4); + // Alert name defined by $row4["nombre"]; + $tipo_modulo = $row2["nombre"]; + $nombre_alerta = $row4["nombre"]; + $string = "
".$nombre_modulo."/".$tipo_modulo; + $string = $string."".$nombre_alerta; + $string = $string."".$row3["time_threshold"]; + $string = $string."".$row3["dis_min"]."/".$row3["dis_max"]; + $string = $string."".salida_limpia($row3["descripcion"]); + $string = $string.""; + $id_grupo = dame_id_grupo($id_agente); + if (give_acl($id_user, $id_grupo, "LW")==1){ + $string = $string."".$lang_label["delete"]."   "; + $string = $string."".$lang_label["update"].""; + } + } } - $sql4='SELECT * FROM talerta WHERE id_alerta = '.$row3["id_alerta"]; - $result4=mysql_query($sql4); - $row4=mysql_fetch_array($result4); - // Alert name defined by $row4["nombre"]; - $tipo_modulo = $row2["nombre"]; - $nombre_alerta = $row4["nombre"]; - echo "
"; - echo $nombre_modulo."/".$tipo_modulo; - echo ""; - echo $nombre_alerta; - echo ""; - echo $row3["time_threshold"]; - echo ""; - echo $row3["dis_min"]."/".$row3["dis_max"]; - echo ""; - echo salida_limpia($row3["descripcion"]); - echo ""; - $id_grupo = dame_id_grupo($id_agente); - if (give_acl($id_user, $id_grupo, "LW")==1){ - echo "".$lang_label["delete"]."   "; - echo "".$lang_label["update"].""; + if (isset($string)) { + echo " + + + + + + "; + echo $string; + echo "
".$lang_label["name_type"]."".$lang_label["alert"]."".$lang_label["time_threshold"]."".$lang_label["min_max"]."".$lang_label["description"]."".$lang_label["action"]."
"; } + else echo "".$lang_label["no_alerts"].""; } -} -echo "
+
';