2008-09-29 Evi Vanoost <vanooste@rcbi.rochester.edu>
* godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager_editor.php, godmode/agentes/configurar_agente.php: Style updates. These files now use the database functions and can be used as a template for the others. Resolved bug #2124706 where a blank page would come up in case the module type would be wrong. Now displays an error message git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1122 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
14723eaf1f
commit
ab77462b0f
|
@ -1,3 +1,12 @@
|
||||||
|
2008-09-29 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager_editor_data.php,
|
||||||
|
godmode/agentes/module_manager_editor.php,
|
||||||
|
godmode/agentes/configurar_agente.php: Style updates. These files now
|
||||||
|
use the database functions and can be used as a template for the
|
||||||
|
others. Resolved bug #2124706 where a blank page would come up in
|
||||||
|
case the module type would be wrong. Now displays an error message
|
||||||
|
|
||||||
2008-09-25 Jorge Gonzalez <jorgegonz@artica.es>
|
2008-09-25 Jorge Gonzalez <jorgegonz@artica.es>
|
||||||
|
|
||||||
* include/help/es: created directory for Spanish help files.
|
* include/help/es: created directory for Spanish help files.
|
||||||
|
|
|
@ -22,15 +22,18 @@ require("include/config.php");
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
if (! give_acl($config["id_user"], 0, "AW")) {
|
//See if id_agente is set (either POST or GET, otherwise -1
|
||||||
|
$id_agente = get_parameter ("id_agente", -1);
|
||||||
|
|
||||||
|
$group = dame_id_grupo ($id_agente); //Will return 0 or an int
|
||||||
|
|
||||||
|
if (! give_acl($config["id_user"], $group, "AW")) {
|
||||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||||
"Trying to access agent manager");
|
"Trying to access agent manager");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
};
|
}
|
||||||
|
|
||||||
//See if id_agente is set (either POST or GET, otherwise -1
|
|
||||||
$id_agente = get_parameter ("id_agente", -1);
|
|
||||||
|
|
||||||
// Get passed variables
|
// Get passed variables
|
||||||
$tab = get_parameter_get ("tab","main");
|
$tab = get_parameter_get ("tab","main");
|
||||||
|
@ -242,46 +245,56 @@ if (isset ($_POST["create_agent"])) {
|
||||||
// Fix / Normalize module data
|
// Fix / Normalize module data
|
||||||
// ===========================
|
// ===========================
|
||||||
if (isset($_GET["fix_module"])){
|
if (isset($_GET["fix_module"])){
|
||||||
$id_module = $_GET["fix_module"];
|
$id_module = get_parameter_get ("fix_module",0);
|
||||||
$id_agent = $_GET["id_agente"];
|
|
||||||
// get info about this module
|
// get info about this module
|
||||||
$sql1 = "SELECT AVG(datos) FROM tagente_datos WHERE id_agente_modulo = $id_module AND id_agente = $id_agent";
|
$media = get_agent_module_value_average ($id_module, 30758400); //Get average over the year
|
||||||
$result=mysql_query($sql1);
|
$media *= 1.3;
|
||||||
if ($row=mysql_fetch_array($result)){
|
$error = "";
|
||||||
$media = $row[0];
|
//If the value of media is 0 or something went wrong, don't delete
|
||||||
$media = $media * 1.3;
|
if (!empty ($media)) {
|
||||||
$sql1 = "DELETE FROM tagente_datos WHERE datos > $media AND id_agente_modulo = $id_module AND id_agente = $id_agent";
|
$sql = sprintf ("DELETE FROM tagente_datos WHERE datos > %f AND id_agente_modulo = %d", $media, $id_module);
|
||||||
$result=mysql_query($sql1);
|
$result = process_sql ($sql);
|
||||||
echo "<h3 class='suc'>".__('Deleted data above')." $media</h3>";
|
} else {
|
||||||
|
$result = false;
|
||||||
|
$error = " - ".__('No data to normalize');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result !== false) {
|
||||||
|
echo '<h3 class="suc">'.__('Deleted data above').' '.$media.'</h3>';
|
||||||
|
} else {
|
||||||
|
echo '<h3 class="error">'.__('Error normalizing module').$error.'</h3>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Delete Alert
|
// Delete Alert
|
||||||
// =============
|
// =============
|
||||||
if (isset($_GET["delete_alert"])){ // if modified some parameter
|
if (isset($_GET["delete_alert"])){ // if modified some parameter
|
||||||
$id_borrar_modulo = $_GET["delete_alert"];
|
$id_borrar_modulo = get_parameter_get ("delete_alert",0);
|
||||||
// get info about agent
|
// get info about agent
|
||||||
$sql1='DELETE FROM talerta_agente_modulo WHERE id_aam = '.$id_borrar_modulo;
|
$sql = sprintf ("DELETE FROM talerta_agente_modulo WHERE id_aam = %d", $id_borrar_modulo);
|
||||||
$result=mysql_query($sql1);
|
$result = process_sql ($sql);
|
||||||
if (! $result)
|
|
||||||
echo "<h3 class='error'>".__('There was a problem deleting alert')."</h3>";
|
if ($result === false) {
|
||||||
else
|
echo '<h3 class="error">'.__('There was a problem deleting the alert').'</h3>';
|
||||||
echo "<h3 class='suc'>".__('Alert successfully deleted')."</h3>";
|
} else {
|
||||||
|
echo '<h3 class="suc">'.__('Alert successfully deleted').'</h3>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete Alert component (from a combined)
|
// Delete Alert component (from a combined)
|
||||||
// ==========================================
|
// ==========================================
|
||||||
if (isset($_GET["delete_alert_comp"])){ // if modified some parameter
|
if (isset($_GET["delete_alert_comp"])) { // if modified some parameter
|
||||||
$id_borrar_modulo = $_GET["delete_alert_comp"];
|
$id_borrar_modulo = get_parameter_get ("delete_alert_comp",0);
|
||||||
// get info about agent
|
// get info about agent
|
||||||
$sql1='DELETE FROM tcompound_alert WHERE id_aam = '.$id_borrar_modulo;
|
$sql = sprintf ("DELETE FROM tcompound_alert WHERE id_aam = %d", $id_borrar_modulo);
|
||||||
$result=mysql_query($sql1);
|
$result = process_sql ($sql);
|
||||||
if (! $result)
|
|
||||||
echo "<h3 class='error'>".__('There was a problem deleting alert')."</h3>";
|
if ($result === false) {
|
||||||
else
|
echo '<h3 class="error">'.__('There was a problem deleting alert').'</h3>';
|
||||||
echo "<h3 class='suc'>".__('Alert successfully deleted')."</h3>";
|
} else {
|
||||||
|
echo '<h3 class="suc">'.__('Alert successfully deleted').'</h3>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create alert
|
// Create alert
|
||||||
|
@ -316,48 +329,52 @@ if (isset($_POST["insert_alert"])){ // if created alert
|
||||||
$campo2_rec = get_parameter ("campo_2_rec","");
|
$campo2_rec = get_parameter ("campo_2_rec","");
|
||||||
$campo3_rec = get_parameter ("campo_3_rec","");
|
$campo3_rec = get_parameter ("campo_3_rec","");
|
||||||
|
|
||||||
if ($combined == 1)
|
if ($combined == 1) {
|
||||||
$alert_id_agent = $id_agente;
|
$alert_id_agent = $id_agente;
|
||||||
else
|
} else {
|
||||||
$alert_id_agent = 0;
|
$alert_id_agent = 0;
|
||||||
|
}
|
||||||
if ($time_threshold == -1) {
|
if ($time_threshold == -1) {
|
||||||
$time_threshold = $other;
|
$time_threshold = $other;
|
||||||
}
|
}
|
||||||
$sql_insert="INSERT INTO talerta_agente_modulo
|
|
||||||
(id_agente_modulo,id_alerta,al_campo1,al_campo2,al_campo3,descripcion,dis_max,dis_min,time_threshold,max_alerts, min_alerts, alert_text, disable, time_from, time_to, id_agent, monday, tuesday, wednesday, thursday, friday, saturday, sunday, recovery_notify, priority, al_f2_recovery, al_f3_recovery) VALUES
|
$sql = sprintf ("INSERT INTO talerta_agente_modulo
|
||||||
('$id_agente_modulo',
|
(id_agente_modulo,
|
||||||
'$tipo_alerta',
|
id_alerta,
|
||||||
'$campo_1',
|
al_campo1,
|
||||||
'$campo_2',
|
al_campo2,
|
||||||
'$campo_3',
|
al_campo3,
|
||||||
'$descripcion',
|
descripcion,
|
||||||
'$maximo',
|
dis_max,
|
||||||
'$minimo',
|
dis_min,
|
||||||
'$time_threshold',
|
time_threshold,
|
||||||
'$max_alerts',
|
max_alerts,
|
||||||
'$min_alerts',
|
min_alerts,
|
||||||
'$alert_text',
|
alert_text,
|
||||||
'$disable_alert',
|
disable,
|
||||||
'$time_from',
|
time_from,
|
||||||
'$time_to',
|
time_to,
|
||||||
$alert_id_agent,
|
id_agent,
|
||||||
$alert_d1,
|
monday,
|
||||||
$alert_d2,
|
tuesday,
|
||||||
$alert_d3,
|
wednesday,
|
||||||
$alert_d4,
|
thursday,
|
||||||
$alert_d5,
|
friday,
|
||||||
$alert_d6,
|
saturday,
|
||||||
$alert_d7,
|
sunday,
|
||||||
$alert_recovery,
|
recovery_notify,
|
||||||
$alert_priority,
|
priority,
|
||||||
'$campo2_rec',
|
al_f2_recovery,
|
||||||
'$campo2_rec' )";
|
al_f3_recovery) VALUES
|
||||||
$result=mysql_query($sql_insert);
|
(%d,%d,'%s','%s','%s','%s',%f,%f,%d,%d,%d,'%s',%d,'%s','%s',%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,'%s','%s')",
|
||||||
if (! $result) {
|
$id_agente_modulo, $tipo_alerta, $campo_1, $campo_2, $campo_3, $descripcion, $maximo, $minimo, $time_threshold, $max_alerts, $min_alerts, $alert_text, $disable_alert,
|
||||||
echo "<h3 class='error'>".__('There was a problem creating alert')."</h3>";
|
$time_from, $time_to, $alert_id_agent, $alert_d1, $alert_d2, $alert_d3, $alert_d4, $alert_d5, $alert_d6, $alert_d7, $alert_recovery, $alert_priority, $campo2_rec, $campo3_rec);
|
||||||
|
$id_alerta_agente_modulo = process_sql ($sql, "insert_id");
|
||||||
|
//False or 0 is invalid
|
||||||
|
if (empty ($id_alerta_agente_modulo)) {
|
||||||
|
echo '<h3 class="error">'.__('There was a problem creating alert').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
$id_alerta_agente_modulo = mysql_insert_id();
|
echo '<h3 class="suc">'.__('Alert successfully created').'</h3>';
|
||||||
echo "<h3 class='suc'>".__('Alert successfully created')."</h3>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -368,13 +385,12 @@ if (isset($_POST["add_alert_combined"])){ // Update an existing alert
|
||||||
$alerta_id_aam = get_parameter ("update_alert",-1);
|
$alerta_id_aam = get_parameter ("update_alert",-1);
|
||||||
$component_item = get_parameter ("component_item",-1);
|
$component_item = get_parameter ("component_item",-1);
|
||||||
$component_operation = get_parameter ("component_operation","AND");
|
$component_operation = get_parameter ("component_operation","AND");
|
||||||
$sql_insert = "INSERT INTO tcompound_alert (id, id_aam, operation)
|
$sql = sprintf ("INSERT INTO tcompound_alert (id, id_aam, operation) VALUES (%d, %d, '%s')", $alerta_id_aam, $component_item, $component_operation);
|
||||||
VALUES ($alerta_id_aam, $component_item, '$component_operation')";
|
$result = process_sql ($sql);
|
||||||
$result=mysql_query($sql_insert);
|
if ($result === false) {
|
||||||
if (! $result) {
|
echo '<h3 class="error">'.__('There was a problem creating composite alert').'</h3>';
|
||||||
echo "<h3 class='error'>".__('Problem adding component alert')."</h3>";
|
|
||||||
} else {
|
} else {
|
||||||
echo "<h3 class='suc'>".__('Alert component added ok')."</h3>";
|
echo '<h3 class="suc">'.__('Composite alert successfully created').'</h3>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -425,40 +441,41 @@ if (isset($_POST["update_alert"])){ // Update an existing alert
|
||||||
$time_threshold = $other;
|
$time_threshold = $other;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_insert="UPDATE talerta_agente_modulo SET
|
$sql = sprintf ("UPDATE talerta_agente_modulo SET
|
||||||
id_alerta = $tipo_alerta,
|
id_alerta = %d,
|
||||||
max_alerts = '$max_alerts',
|
max_alerts = %d,
|
||||||
min_alerts = '$min_alerts' ,
|
min_alerts = %d,
|
||||||
time_threshold = '$time_threshold',
|
time_threshold = '%s',
|
||||||
dis_min = '$minimo' ,
|
dis_min = %f,
|
||||||
dis_max = '$maximo' ,
|
dis_max = %f,
|
||||||
al_campo3 = '$campo_3' ,
|
al_campo3 = '%s',
|
||||||
al_campo2 = '$campo_2' ,
|
al_campo2 = '%s',
|
||||||
al_campo1 = '$campo_1' ,
|
al_campo1 = '%s',
|
||||||
descripcion = '$descripcion',
|
descripcion = '%s',
|
||||||
alert_text = '$alert_text',
|
alert_text = '%s',
|
||||||
time_to = '$time_to',
|
time_to = '%s',
|
||||||
time_from = '$time_from',
|
time_from = '%s',
|
||||||
disable = '$disable_alert',
|
disable = %d,
|
||||||
monday = '$alert_d1',
|
monday = %d,
|
||||||
tuesday = '$alert_d2',
|
tuesday = %d,
|
||||||
wednesday = '$alert_d3',
|
wednesday = %d,
|
||||||
thursday = '$alert_d4',
|
thursday = %d,
|
||||||
friday = '$alert_d5',
|
friday = %d,
|
||||||
saturday = '$alert_d6',
|
saturday = %d,
|
||||||
sunday = '$alert_d7',
|
sunday = %d,
|
||||||
recovery_notify = $alert_recovery,
|
recovery_notify = %d,
|
||||||
priority = $alert_priority,
|
priority = %d,
|
||||||
al_f2_recovery = '$campo2_rec',
|
al_f2_recovery = '%s',
|
||||||
al_f3_recovery = '$campo3_rec',
|
al_f3_recovery = '%s',
|
||||||
id_alerta = $tipo_alerta
|
id_alerta = %d WHERE id_aam = %d", $tipo_alerta, $max_alerts, $min_alerts, $time_threshold, $minimo, $maximo, $campo_3, $campo_2, $campo_1, $descripcion, $alert_text,
|
||||||
WHERE id_aam = ".$id_aam;
|
$time_to, $time_from, $disable_alert, $alert_d1, $alert_d2, $alert_d3, $alert_d4, $alert_d5, $alert_d5, $alert_d6, $alert_d7, $alert_recovery, $alert_priority,
|
||||||
$result=mysql_query($sql_insert);
|
$campo2_rec, $campo3_rec, $tipo_alerta, $id_aam);
|
||||||
if (! $result) {
|
$result = process_sql ($sql);
|
||||||
echo "<h3 class='error'>".__('There was a problem updating alert')."</h3>";
|
if ($result === false) {
|
||||||
|
echo '<h3 class="error">'.__('There was a problem updating alert').'</h3>';
|
||||||
|
} else {
|
||||||
|
echo '<h3 class="suc">'.__('Alert successfully updated').'</h3>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
echo "<h3 class='suc'>".__('Agent successfully updated')."</h3>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================
|
// ================
|
||||||
|
@ -529,91 +546,88 @@ if ((isset($agent_created_ok)) && ($agent_created_ok == 1)){
|
||||||
// Read agent data
|
// Read agent data
|
||||||
// This should be at the end of all operation checks, to read the changess
|
// This should be at the end of all operation checks, to read the changess
|
||||||
if (isset($_GET["id_agente"])) {
|
if (isset($_GET["id_agente"])) {
|
||||||
$id_agente = $_GET["id_agente"];
|
$id_agente = get_parameter_get ("id_agente"); //This has been done in the beginning of the page, but if an agent was created, this id might change
|
||||||
$id_grupo = dame_id_grupo($id_agente);
|
$id_grupo = dame_id_grupo ($id_agente);
|
||||||
if (give_acl($config["id_user"], $id_grupo, "AW")==1){
|
if (give_acl ($config["id_user"], $id_grupo, "AW") != 1) {
|
||||||
$sql1='SELECT * FROM tagente WHERE id_agente = '.$id_agente;
|
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to admin an agent without access");
|
||||||
$result=mysql_query($sql1);
|
|
||||||
if ($row=mysql_fetch_array($result)){
|
|
||||||
$intervalo = $row["intervalo"]; // Define interval in seconds
|
|
||||||
$nombre_agente = $row["nombre"];
|
|
||||||
$direccion_agente =$row["direccion"];
|
|
||||||
$grupo = $row["id_grupo"];
|
|
||||||
$ultima_act = $row["ultimo_contacto"];
|
|
||||||
$comentarios = $row["comentarios"];
|
|
||||||
$id_plugin_server = $row["id_plugin_server"];
|
|
||||||
$id_network_server = $row["id_network_server"];
|
|
||||||
$id_prediction_server = $row["id_prediction_server"];
|
|
||||||
$id_wmi_server = $row["id_wmi_server"];
|
|
||||||
$modo = $row["modo"];
|
|
||||||
$id_os = $row["id_os"];
|
|
||||||
$disabled=$row["disabled"];
|
|
||||||
$id_parent = $row["id_parent"];
|
|
||||||
} else {
|
|
||||||
echo "<h3 class='error'>".__('There was a problem loading agent')."</h3>";
|
|
||||||
echo "</table>";
|
|
||||||
echo "</div><div id='foot'>";
|
|
||||||
include ("general/footer.php");
|
|
||||||
echo "</div>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to admin an Agent out of admin groups!");
|
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
echo "</table>";
|
exit;
|
||||||
require ("general/footer.php");
|
}
|
||||||
|
|
||||||
|
$row = get_db_row ('tagente', 'id_agente', $id_agente);
|
||||||
|
if (empty ($row)) {
|
||||||
|
//Close out the page
|
||||||
|
echo '<h3 class="error">'.__('There was a problem loading agent').'</h3>';
|
||||||
|
echo '</table></div><div id="foot">';
|
||||||
|
include ("general/footer.php");
|
||||||
|
echo "</div>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$intervalo = $row["intervalo"]; // Define interval in seconds
|
||||||
|
$nombre_agente = $row["nombre"];
|
||||||
|
$direccion_agente = $row["direccion"];
|
||||||
|
$grupo = $row["id_grupo"];
|
||||||
|
$ultima_act = $row["ultimo_contacto"];
|
||||||
|
$comentarios = $row["comentarios"];
|
||||||
|
$id_plugin_server = $row["id_plugin_server"];
|
||||||
|
$id_network_server = $row["id_network_server"];
|
||||||
|
$id_prediction_server = $row["id_prediction_server"];
|
||||||
|
$id_wmi_server = $row["id_wmi_server"];
|
||||||
|
$modo = $row["modo"];
|
||||||
|
$id_os = $row["id_os"];
|
||||||
|
$disabled = $row["disabled"];
|
||||||
|
$id_parent = $row["id_parent"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read data module if editing module
|
// Read data module if editing module
|
||||||
// ==================================
|
// ==================================
|
||||||
if ((isset($_GET["update_module"])) && (!isset($_POST["oid"])) && (!isset($_POST["update_module"]))) {
|
if ((isset ($_GET["update_module"])) && (!isset ($_POST["oid"])) && (!isset ($_POST["update_module"]))) {
|
||||||
$update_module = 1;
|
$update_module = 1;
|
||||||
$id_agente_modulo = $_GET["update_module"];
|
$id_agente_modulo = (int) get_parameter_get ("update_module",0);
|
||||||
|
|
||||||
$sql_update = "SELECT * FROM tagente_modulo
|
$row = get_db_row ('tagente_modulo', 'id_agente_modulo', $id_agente_modulo);
|
||||||
WHERE id_agente_modulo = ".$id_agente_modulo;
|
|
||||||
$result=mysql_query($sql_update);
|
if ($row === false) {
|
||||||
while ($row=mysql_fetch_array($result)){
|
echo '<h3 class="error">'.__('There was a problem loading the module').'</h3>';
|
||||||
|
} else {
|
||||||
$modulo_id_agente = $row["id_agente"];
|
$modulo_id_agente = $row["id_agente"];
|
||||||
$modulo_id_tipo_modulo = $row["id_tipo_modulo"];
|
$modulo_id_tipo_modulo = $row["id_tipo_modulo"];
|
||||||
$modulo_nombre = $row["nombre"];
|
$modulo_nombre = $row["nombre"];
|
||||||
$modulo_descripcion = $row["descripcion"];
|
$modulo_descripcion = $row["descripcion"];
|
||||||
$tcp_send = $row["tcp_send"];
|
$tcp_send = $row["tcp_send"];
|
||||||
$tcp_rcv = $row["tcp_rcv"];
|
$tcp_rcv = $row["tcp_rcv"];
|
||||||
$tcp_port = $row["tcp_port"];
|
|
||||||
$ip_target = $row["ip_target"];
|
$ip_target = $row["ip_target"];
|
||||||
$snmp_community = $row["snmp_community"];
|
$snmp_community = $row["snmp_community"];
|
||||||
$snmp_oid = $row["snmp_oid"];
|
$snmp_oid = $row["snmp_oid"];
|
||||||
$id_module_group = $row["id_module_group"];
|
$id_module_group = $row["id_module_group"];
|
||||||
$module_interval = $row["module_interval"];
|
$module_interval = $row["module_interval"];
|
||||||
$modulo_max = $row["max"];
|
$modulo_max = $row["max"];
|
||||||
if (! isset($modulo_max))
|
if (empty ($modulo_max))
|
||||||
$modulo_max ="N/A";
|
$modulo_max = "N/A";
|
||||||
$modulo_min = $row["min"];
|
if (empty ($modulo_min))
|
||||||
if (! isset($modulo_min))
|
$modulo_min = "N/A";
|
||||||
$modulo_min ="N/A";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read ALERT data if editing alert
|
// Read ALERT data if editing alert
|
||||||
// ==================================
|
// ==================================
|
||||||
|
if (isset ($_GET["update_alert"])) {
|
||||||
if (isset($_GET["update_alert"])){
|
$id_grupo = dame_id_grupo ($id_agente);
|
||||||
$id_grupo = dame_id_grupo($id_agente);
|
if (give_acl ($config["id_user"], $id_grupo, "LW") == 0){
|
||||||
if (give_acl($config["id_user"], $id_grupo, "LW")==0){
|
|
||||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to update an alert without admin rights");
|
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to update an alert without admin rights");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
echo "</table>";
|
|
||||||
require ("general/footer.php");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_alert = 1;
|
$update_alert = 1;
|
||||||
$id_aam = $_GET["update_alert"];
|
$id_aam = (int) get_parameter_get ("update_alert",0);
|
||||||
$sql_update = "SELECT * FROM talerta_agente_modulo WHERE id_aam = ".$id_aam;
|
$row = get_db_row ('talerta_agente_modulo', 'id_aam', $id_aam);
|
||||||
$result=mysql_query($sql_update);
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
if ($row === false) {
|
||||||
$alerta_id_aam = $id_aam;
|
echo '<h3 class="error">'.__('There was a problem loading the alert').'</h3>';
|
||||||
|
} else {
|
||||||
|
$alerta_id_aam = $row["id_aam"];
|
||||||
$alerta_campo1 = $row["al_campo1"];
|
$alerta_campo1 = $row["al_campo1"];
|
||||||
$alerta_campo2 = $row["al_campo2"];
|
$alerta_campo2 = $row["al_campo2"];
|
||||||
$alerta_campo3 = $row["al_campo3"];
|
$alerta_campo3 = $row["al_campo3"];
|
||||||
|
@ -646,85 +660,87 @@ if (isset($_GET["update_alert"])){
|
||||||
|
|
||||||
// GET DATA for MODULE UPDATE OR MODULE INSERT
|
// GET DATA for MODULE UPDATE OR MODULE INSERT
|
||||||
// ===========================================
|
// ===========================================
|
||||||
if ((isset($_POST["update_module"])) || (isset($_POST["insert_module"]))) {
|
if ((isset ($_POST["update_module"])) || (isset ($_POST["insert_module"]))) {
|
||||||
if (isset($_POST["update_module"])){
|
if (isset ($_POST["update_module"])) {
|
||||||
$update_module = 1;
|
$update_module = 1;
|
||||||
$id_agente_modulo = $_POST["id_agente_modulo"];
|
$id_agente_modulo = get_parameter_post ("id_agente_modulo",0);
|
||||||
}
|
}
|
||||||
$id_grupo = dame_id_grupo($id_agente);
|
|
||||||
if (give_acl($config["id_user"], $id_grupo, "AW")==0){
|
$id_grupo = dame_id_grupo ($id_agente);
|
||||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to create a module without admin rights");
|
|
||||||
|
if (give_acl ($config["id_user"], $id_grupo, "AW") == 0) {
|
||||||
|
audit_db ($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to create a module without admin rights");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
echo "</table>";
|
|
||||||
require ("general/footer.php");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$form_id_tipo_modulo = get_parameter ("form_id_tipo_modulo");
|
$form_id_tipo_modulo = (int) get_parameter ("form_id_tipo_modulo",0);
|
||||||
$form_name = get_parameter ("form_name");
|
$form_name = (string) get_parameter ("form_name",0);
|
||||||
$form_description = get_parameter ("form_description");
|
$form_description = (string) get_parameter ("form_description","");
|
||||||
$form_id_module_group = get_parameter ("form_id_module_group",0);
|
$form_id_module_group = (int) get_parameter ("form_id_module_group",0);
|
||||||
$form_flag = get_parameter ("form_flag",0);
|
$form_flag = (bool) get_parameter ("form_flag",0);
|
||||||
$form_post_process = get_parameter ("form_post_process",0);
|
$form_post_process = (float) get_parameter ("form_post_process",0);
|
||||||
$form_prediction_module = get_parameter ("form_prediction_module",0);
|
$form_prediction_module = (int) get_parameter ("form_prediction_module",0);
|
||||||
$form_max_timeout = get_parameter ("form_max_timeout",0);
|
$form_max_timeout = (int) get_parameter ("form_max_timeout",0);
|
||||||
$form_minvalue = get_parameter_post ("form_minvalue",0);
|
$form_minvalue = (int) get_parameter_post ("form_minvalue",0);
|
||||||
$form_maxvalue = get_parameter ("form_maxvalue",0);
|
$form_maxvalue = (int) get_parameter ("form_maxvalue",0);
|
||||||
$form_interval = get_parameter ("form_interval",300);
|
$form_interval = (int) get_parameter ("form_interval",300);
|
||||||
$form_id_prediction_module = get_parameter ("form_id_prediction_module",0);
|
$form_id_prediction_module = (int) get_parameter ("form_id_prediction_module",0);
|
||||||
$form_id_plugin = get_parameter ("form_id_plugin",0);
|
$form_id_plugin = (int) get_parameter ("form_id_plugin",0);
|
||||||
$form_id_export = get_parameter ("form_id_export",0);
|
$form_id_export = (int) get_parameter ("form_id_export",0);
|
||||||
$form_disabled = get_parameter ("form_disabled",0);
|
$form_disabled = (bool) get_parameter ("form_disabled",0);
|
||||||
$form_tcp_send = get_parameter ("form_tcp_send","");
|
$form_tcp_send = (string) get_parameter ("form_tcp_send","");
|
||||||
$form_tcp_rcv = get_parameter ("form_tcp_rcv","");
|
$form_tcp_rcv = (string) get_parameter ("form_tcp_rcv","");
|
||||||
$form_tcp_port = get_parameter ("form_tcp_port",0);
|
$form_tcp_port = (int) get_parameter ("form_tcp_port",0);
|
||||||
$form_snmp_community = get_parameter ("form_snmp_community","");
|
$form_snmp_community = (string) get_parameter ("form_snmp_community","");
|
||||||
$form_snmp_oid = get_parameter ("form_snmp_oid","");
|
$form_snmp_oid = (string) get_parameter ("form_snmp_oid","");
|
||||||
$form_ip_target = get_parameter ("form_ip_target","");
|
$form_ip_target = (string) get_parameter ("form_ip_target","");
|
||||||
$form_plugin_user = get_parameter ("form_plugin_user","");
|
$form_plugin_user = (string) get_parameter ("form_plugin_user","");
|
||||||
$form_plugin_pass = get_parameter ("form_plugin_pass","");
|
$form_plugin_pass = (string) get_parameter ("form_plugin_pass","");
|
||||||
$form_plugin_parameter = get_parameter ("form_plugin_parameter","");
|
$form_plugin_parameter = (string) get_parameter ("form_plugin_parameter","");
|
||||||
$form_id_modulo = get_parameter ("form_id_modulo");
|
$form_id_modulo = (int) get_parameter ("form_id_modulo",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODULE UPDATE
|
// MODULE UPDATE
|
||||||
// =================
|
// =================
|
||||||
if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified something
|
if ((isset ($_POST["update_module"])) && (!isset ($_POST["oid"]))) { // if modified something
|
||||||
if (isset($_POST["form_combo_snmp_oid"])){
|
if (isset ($_POST["form_combo_snmp_oid"])) {
|
||||||
$form_combo_snmp_oid = entrada_limpia($_POST["form_combo_snmp_oid"]);
|
$form_combo_snmp_oid = get_parameter_post ("form_combo_snmp_oid");
|
||||||
if ($snmp_oid == ""){
|
if ($snmp_oid == "") {
|
||||||
$snmp_oid = $form_combo_snmp_oid;
|
$snmp_oid = $form_combo_snmp_oid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql_update = "UPDATE tagente_modulo
|
$sql = sprintf ("UPDATE tagente_modulo SET
|
||||||
SET descripcion = '$form_description',
|
descripcion = '%s',
|
||||||
nombre = '$form_name',
|
nombre = '%s',
|
||||||
max = '$form_maxvalue',
|
max = %d,
|
||||||
min = '$form_minvalue',
|
min = %d,
|
||||||
module_interval = '$form_interval',
|
module_interval = %d,
|
||||||
tcp_port = '$form_tcp_port',
|
tcp_port = %d,
|
||||||
tcp_send = '$form_tcp_send',
|
tcp_send = '%s',
|
||||||
tcp_rcv = '$form_tcp_rcv',
|
tcp_rcv = '%s',
|
||||||
snmp_community = '$form_snmp_community',
|
snmp_community = '%s',
|
||||||
snmp_oid = '$form_snmp_oid',
|
snmp_oid = '%s',
|
||||||
ip_target = '$form_ip_target',
|
ip_target = '%s',
|
||||||
id_module_group = '$form_id_module_group',
|
flag = %d,
|
||||||
flag = '$form_flag',
|
id_modulo = %d,
|
||||||
id_modulo = '$form_id_modulo',
|
disabled = %d,
|
||||||
disabled = '$form_disabled',
|
id_export = %d,
|
||||||
id_export = '$form_id_export',
|
plugin_user = '%s',
|
||||||
plugin_user = '$form_plugin_user',
|
plugin_pass = '%s',
|
||||||
plugin_pass = '$form_plugin_pass',
|
plugin_parameter = '%s',
|
||||||
plugin_parameter = '$form_plugin_parameter',
|
id_plugin = %d,
|
||||||
id_plugin = '$form_id_plugin',
|
post_process = %f,
|
||||||
post_process = '$form_post_process',
|
prediction_module = %d,
|
||||||
prediction_module = '$form_prediction_module',
|
max_timeout = %d
|
||||||
max_timeout = '$form_max_timeout'
|
WHERE id_agente_modulo = %d", $form_description, $form_name, $form_maxvalue, $form_minvalue, $form_interval, $form_tcp_port, $form_tcp_send, $form_tcp_rcv,
|
||||||
WHERE id_agente_modulo = '$id_agente_modulo'";
|
$form_snmp_community, $form_snmp_oid, $form_ip_target, $form_flag, $form_id_modulo, $form_disabled, $form_id_export, $form_plugin_user, $form_plugin_pass,
|
||||||
$result=mysql_query($sql_update);
|
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $id_agente_modulo);
|
||||||
if (! $result) {
|
$result = process_sql ($sql);
|
||||||
echo "<h3 class='error'>".__('There was a problem updating module')."</h3>";
|
|
||||||
|
if ($result === false) {
|
||||||
|
echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
echo "<h3 class='suc'>".__('Module successfully updated')."</h3>";
|
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -732,12 +748,14 @@ if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified
|
||||||
// OID Refresh button to get SNMPWALK from data in form
|
// OID Refresh button to get SNMPWALK from data in form
|
||||||
// This code is also applied when submitting a new module (insert_module = 1)
|
// This code is also applied when submitting a new module (insert_module = 1)
|
||||||
// =========================================================
|
// =========================================================
|
||||||
if (isset($_POST["oid"])){
|
if (isset ($_POST["oid"])){
|
||||||
snmp_set_quick_print(1);
|
snmp_set_quick_print (1);
|
||||||
if (! ($snmpwalk = snmprealwalk($form_ip_target, $form_snmp_community, ""))) {
|
$snmpwalk = snmprealwalk ($form_ip_target, $form_snmp_community, '');
|
||||||
echo "<h3 class='error'>".__('Cannot read from SNMP source')."</h3>";
|
|
||||||
|
if (empty ($snmpwalk)) {
|
||||||
|
echo '<h3 class="error">'.__('Cannot read from SNMP source').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
echo "<h3 class='suc'>".__('SNMP source has been scanned')."</h3>";
|
echo '<h3 class="suc">'.__('SNMP source has been scanned').'</h3>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,10 +764,10 @@ if (isset($_POST["oid"])){
|
||||||
// MODULE INSERT
|
// MODULE INSERT
|
||||||
// =========================================================
|
// =========================================================
|
||||||
|
|
||||||
if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1))) && (!isset($_POST["oid"])) && (isset($_POST["insert_module"])) && (isset($_POST['crtbutton']))){
|
if (((!isset ($_POST["nc"]) OR ($_POST["nc"] == -1))) && (!isset ($_POST["oid"])) && (isset ($_POST["insert_module"])) && (isset ($_POST['crtbutton']))) {
|
||||||
|
|
||||||
if (isset($_POST["form_combo_snmp_oid"])) {
|
if (isset ($_POST["form_combo_snmp_oid"])) {
|
||||||
$combo_snmp_oid = entrada_limpia($_POST["form_combo_snmp_oid"]);
|
$combo_snmp_oid = get_parameter_post ("form_combo_snmp_oid");
|
||||||
}
|
}
|
||||||
if ($form_snmp_oid == ""){
|
if ($form_snmp_oid == ""){
|
||||||
$form_snmp_oid = $combo_snmp_oid;
|
$form_snmp_oid = $combo_snmp_oid;
|
||||||
|
@ -757,19 +775,20 @@ if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1))) && (!isset($_POST["oid"])) &&
|
||||||
if ($form_tcp_port == "") {
|
if ($form_tcp_port == "") {
|
||||||
$form_tcp_port= "0";
|
$form_tcp_port= "0";
|
||||||
}
|
}
|
||||||
$sql_insert = "INSERT INTO tagente_modulo
|
$sql = sprintf ("INSERT INTO tagente_modulo
|
||||||
(id_agente, id_tipo_modulo, nombre, descripcion, max, min, snmp_oid, snmp_community,
|
(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, id_export,
|
id_module_group, module_interval, ip_target, tcp_port, tcp_rcv, tcp_send, id_export,
|
||||||
plugin_user, plugin_pass, plugin_parameter, id_plugin, post_process, prediction_module,
|
plugin_user, plugin_pass, plugin_parameter, id_plugin, post_process, prediction_module,
|
||||||
max_timeout, disabled, id_modulo)
|
max_timeout, disabled, id_modulo)
|
||||||
VALUES ($id_agente, $form_id_tipo_modulo, '$form_name', '$form_description', $form_maxvalue, $form_minvalue, '$form_snmp_oid', '$form_snmp_community', $form_id_module_group, $form_interval, '$form_ip_target', $form_tcp_port, '$form_tcp_rcv', '$form_tcp_send', $form_id_export, '$form_plugin_user', '$form_plugin_pass', '$form_plugin_parameter', $form_id_plugin, $form_post_process, $form_id_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo)";
|
VALUES (%d,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%d,'%s','%s',%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d)",
|
||||||
$result=mysql_query($sql_insert);
|
$id_agente, $form_id_tipo_modulo, $form_name, $form_description, $form_maxvalue, $form_minvalue, $form_snmp_oid, $form_snmp_community,
|
||||||
if (! $result){
|
$form_id_module_group, $form_interval, $form_ip_target, $form_tcp_port, $form_tcp_rcv, $form_tcp_send, $form_id_export, $form_plugin_user, $form_plugin_pass,
|
||||||
echo "<h3 class='error'>".__('There was a problem adding module')."</h3>";
|
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_id_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo);
|
||||||
echo "<i>DEBUG: $sql_insert</i>";
|
$id_agente_modulo = process_sql ($sql, 'insert_id');
|
||||||
|
echo $sql;
|
||||||
|
if ($id_agente_modulo === false){
|
||||||
|
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
echo "<h3 class='suc'>".__('Module added successfully')."</h3>";
|
|
||||||
$id_agente_modulo = mysql_insert_id();
|
|
||||||
// Create with different estado if proc type or data type
|
// Create with different estado if proc type or data type
|
||||||
if (($form_id_tipo_modulo == 2) || // data_proc
|
if (($form_id_tipo_modulo == 2) || // data_proc
|
||||||
($form_id_tipo_modulo == 6) || // icmp_proc
|
($form_id_tipo_modulo == 6) || // icmp_proc
|
||||||
|
@ -778,57 +797,76 @@ if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1))) && (!isset($_POST["oid"])) &&
|
||||||
($form_id_tipo_modulo == 21) || // async proc
|
($form_id_tipo_modulo == 21) || // async proc
|
||||||
($form_id_tipo_modulo == 100) // Keepalive
|
($form_id_tipo_modulo == 100) // Keepalive
|
||||||
) {
|
) {
|
||||||
$sql_insert2 = "INSERT INTO tagente_estado
|
$sql = sprintf ("INSERT INTO tagente_estado
|
||||||
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
|
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
|
||||||
VALUES (
|
VALUES (%d, 0,'0000-00-00 00:00:00',0,0,%d,0)",$id_agente_modulo,$id_agente);
|
||||||
$id_agente_modulo, 0,'0000-00-00 00:00:00',0,0,'".$id_agente."',0
|
|
||||||
)";
|
|
||||||
} else {
|
} else {
|
||||||
$sql_insert2 = "INSERT INTO tagente_estado
|
$sql = sprintf ("INSERT INTO tagente_estado
|
||||||
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
|
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
|
||||||
VALUES (
|
VALUES (%d, 0,'0000-00-00 00:00:00',0,100,%d,0)",$id_agente_modulo,$id_agente);
|
||||||
$id_agente_modulo, 0,'0000-00-00 00:00:00',0,100,'".$id_agente."',0
|
}
|
||||||
)";
|
$result = process_sql ($sql);
|
||||||
|
if ($result !== false) {
|
||||||
|
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
||||||
|
} else {
|
||||||
|
echo '<h3 class="error">'.__('Module added successfully').' - '.__('Status init unsuccessful').'</h3>';
|
||||||
}
|
}
|
||||||
$result=mysql_query($sql_insert2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODULE DELETION
|
// MODULE DELETION
|
||||||
// =================
|
// =================
|
||||||
if (isset($_GET["delete_module"])){ // DELETE agent module !
|
if (isset ($_GET["delete_module"])){ // DELETE agent module !
|
||||||
$id_borrar_modulo = $_GET["delete_module"];
|
$id_borrar_modulo = (int) get_parameter_get ("delete_module",0);
|
||||||
$id_grupo = dame_id_grupo($id_agente); if (give_acl($config["id_user"], $id_grupo, "AW")==0){
|
$id_grupo = (int) dame_id_grupo ($id_agente);
|
||||||
|
|
||||||
|
if (give_acl ($config["id_user"], $id_grupo, "AW") == 0){
|
||||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation",
|
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation",
|
||||||
"Trying to delete a module without admin rights");
|
"Trying to delete a module without admin rights");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// First detele from tagente_modulo
|
|
||||||
$sql_delete= "DELETE FROM tagente_modulo
|
if ($id_borrar_modulo < 1) {
|
||||||
WHERE id_agente_modulo = ".$id_borrar_modulo;
|
audit_db ($config["id_user"],$REMOTE_ADDR, "HACK Attempt",
|
||||||
$result=mysql_query($sql_delete);
|
"Expected variable from form is not correct");
|
||||||
if (! $result) {
|
die ("Nice try buddy");
|
||||||
echo "<h3 class='error'>".__('There was a problem deleting module')."</h3>";
|
exit;
|
||||||
} else {
|
|
||||||
echo "<h3 class='suc'>".__('Module deleted successfully')."</h3>";
|
|
||||||
}
|
}
|
||||||
// Then delete all staus
|
|
||||||
$sql_delete = "DELETE FROM tagente_estado
|
|
||||||
WHERE id_agente_modulo = ".$id_borrar_modulo;
|
|
||||||
$result=mysql_query($sql_delete);
|
|
||||||
|
|
||||||
$sql_delete = "DELETE FROM tagente_datos
|
//Init transaction
|
||||||
WHERE id_agente_modulo = ".$id_borrar_modulo;
|
$error = 0;
|
||||||
$result=mysql_query($sql_delete);
|
process_sql ("SET AUTOCOMMIT=0;");
|
||||||
|
process_sql ("START TRANSACTION;");
|
||||||
|
|
||||||
$sql_delete = "DELETE FROM tagente_datos_string
|
// First delete from tagente_modulo -> if not successful, increment
|
||||||
WHERE id_agente_modulo = ".$id_borrar_modulo;
|
// error
|
||||||
$result=mysql_query($sql_delete);
|
if (process_sql ("DELETE FROM tagente_modulo WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||||
|
$error++;
|
||||||
|
|
||||||
$sql_delete = "DELETE FROM tagente_datos_inc
|
if (process_sql ("DELETE FROM tagente_estado WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||||
WHERE id_agente_modulo = ".$id_borrar_modulo;
|
$error++;
|
||||||
$result=mysql_query($sql_delete);
|
|
||||||
|
if (process_sql ("DELETE FROM tagente_datos WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
if (process_sql ("DELETE FROM tagente_datos_string WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
if (process_sql ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
//Check for errors
|
||||||
|
if ($error != 0) {
|
||||||
|
echo '<h3 class="error">'.__('There was a problem deleting the module').'</h3>';
|
||||||
|
process_sql ("ROLLBACK;");
|
||||||
|
} else {
|
||||||
|
echo '<h3 class="suc">'.__('Module deleted successfully').'</h3>';
|
||||||
|
process_sql ("COMMIT;");
|
||||||
|
}
|
||||||
|
|
||||||
|
//End transaction
|
||||||
|
process_sql ("SET AUTOCOMMIT=1;");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
@ -840,19 +878,25 @@ switch ($tab) {
|
||||||
require "agent_manager.php";
|
require "agent_manager.php";
|
||||||
break;
|
break;
|
||||||
case "module":
|
case "module":
|
||||||
if (($form_moduletype == "") && ($moduletype == ""))
|
if (($form_moduletype == "") && ($moduletype == "")) {
|
||||||
require "module_manager.php";
|
require "module_manager.php";
|
||||||
else
|
} else {
|
||||||
require "module_manager_editor.php";
|
require "module_manager_editor.php";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "alert":
|
case "alert":
|
||||||
if (($form_alerttype == "") && (!isset($_GET["update_alert"])))
|
if (($form_alerttype == "") && (!isset($_GET["update_alert"]))) {
|
||||||
require "alert_manager.php";
|
require "alert_manager.php";
|
||||||
else
|
} else {
|
||||||
require "alert_manager_editor.php";
|
require "alert_manager_editor.php";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "template":
|
case "template":
|
||||||
require "agent_template.php";
|
require "agent_template.php";
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
//This will make sure that blank pages will have at least some
|
||||||
|
//debug info in them
|
||||||
|
echo '<h3 class="error">DEBUG: Invalid tab specified in '.__FILE__.':'.__LINE__.'</h3>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -19,14 +19,13 @@
|
||||||
|
|
||||||
|
|
||||||
// General startup for established session
|
// General startup for established session
|
||||||
global $config;
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
// Specific ACL check
|
// Specific ACL check
|
||||||
if (give_acl($config["id_user"], 0, "AW")!=1) {
|
if (give_acl ($config["id_user"], 0, "AW") != 1) {
|
||||||
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
||||||
require ($config["homedir"]."/general/noaccess.php");
|
require ($config["homedir"]."/general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Following variables come from module_manager.php -> configurar_agente.php :
|
// Following variables come from module_manager.php -> configurar_agente.php :
|
||||||
|
@ -34,7 +33,7 @@ if (give_acl($config["id_user"], 0, "AW")!=1) {
|
||||||
// $form_moduletype: could be [1] Agent module/Data server, [2] network server, [4] plugin server, [6] wmiserver, or [5] predictionserver
|
// $form_moduletype: could be [1] Agent module/Data server, [2] network server, [4] plugin server, [6] wmiserver, or [5] predictionserver
|
||||||
// $moduletype: helper to fix get/post method; copy of $form_moduletype just to edit modules, not to create them
|
// $moduletype: helper to fix get/post method; copy of $form_moduletype just to edit modules, not to create them
|
||||||
|
|
||||||
if (($form_moduletype == "") && ($moduletype != "")){
|
if (($form_moduletype == "") && ($moduletype != "")) {
|
||||||
switch ($moduletype) {
|
switch ($moduletype) {
|
||||||
case "1":
|
case "1":
|
||||||
$form_moduletype = "dataserver";
|
$form_moduletype = "dataserver";
|
||||||
|
@ -51,91 +50,100 @@ if (($form_moduletype == "") && ($moduletype != "")){
|
||||||
case "6":
|
case "6":
|
||||||
$form_moduletype = "wmiserver";
|
$form_moduletype = "wmiserver";
|
||||||
break;
|
break;
|
||||||
|
//This will make sure that blank pages will
|
||||||
|
//have at least some debug info in them
|
||||||
|
default:
|
||||||
|
echo '<h3 class="error">DEBUG: Invalid module type specified in '.__FILE__.':'.__LINE__.'</h3>';
|
||||||
|
echo 'Most likely you have recently upgraded from an earlier version of Pandora and either <br />
|
||||||
|
1) forgot to use the database converter<br />
|
||||||
|
2) used a bad version of the database converter (see Bugreport #2124706 for the solution)<br />
|
||||||
|
3) found a new bug - please report a way to duplicate this error';
|
||||||
|
return; //We return control to the invoking script so the page finishes rendering
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get form (GET)
|
// Get form
|
||||||
$form_network_component = get_parameter_get("form_network_component", "");
|
$form_network_component = get_parameter ("form_network_component", "");
|
||||||
if($form_network_component == "")
|
|
||||||
$form_network_component = get_parameter_post("form_network_component", "");
|
|
||||||
|
|
||||||
// Using network component to fill some fields
|
// Using network component to fill some fields
|
||||||
if (($form_moduletype == "networkserver" || $form_moduletype == "wmiserver") && ($form_network_component != "") && (!isset($_POST['crtbutton'])) && (!isset($_POST['oid']))){
|
if (($form_moduletype == "networkserver" || $form_moduletype == "wmiserver") && ($form_network_component != "") && (!isset($_POST['crtbutton'])) && (!isset($_POST['oid']))) {
|
||||||
// Preload data from template
|
// Preload data from template
|
||||||
$row = get_db_row ("tnetwork_component", 'id_nc', $form_network_component);
|
$row = get_db_row ("tnetwork_component", 'id_nc', $form_network_component);
|
||||||
if ($row == 0){
|
if (empty ($row))
|
||||||
unmanaged_error("Cannot load tnetwork_component reference from previous page");
|
unmanaged_error ("Cannot load tnetwork_component reference from previous page");
|
||||||
}
|
|
||||||
$form_id_tipo_modulo = $row["type"];
|
$form_id_tipo_modulo = $row["type"];
|
||||||
$form_id_module_group = $row["id_module_group"];
|
$form_id_module_group = $row["id_module_group"];
|
||||||
$form_name = $row["name"];
|
$form_name = $row["name"];
|
||||||
$form_descripcion = $row["description"];
|
$form_descripcion = $row["description"];
|
||||||
$form_tcp_send = $row["tcp_send"];
|
$form_tcp_send = $row["tcp_send"];
|
||||||
$form_tcp_rcv = $row["tcp_rcv"];
|
$form_tcp_rcv = $row["tcp_rcv"];
|
||||||
$form_tcp_port = $row["tcp_port"];
|
$form_tcp_port = $row["tcp_port"];
|
||||||
$form_snmp_community = $row["snmp_community"];
|
$form_snmp_community = $row["snmp_community"];
|
||||||
$form_snmp_oid = $row["snmp_oid"];
|
$form_snmp_oid = $row["snmp_oid"];
|
||||||
$form_id_module_group = $row["id_module_group"];
|
$form_id_module_group = $row["id_module_group"];
|
||||||
$form_interval = $row["module_interval"];
|
$form_interval = $row["module_interval"];
|
||||||
$form_maxvalue = $row["max"];
|
$form_maxvalue = $row["max"];
|
||||||
$form_minvalue = $row["min"];
|
$form_minvalue = $row["min"];
|
||||||
$form_max_timeout = $row["max_timeout"];
|
$form_max_timeout = $row["max_timeout"];
|
||||||
$form_id_export = 0;
|
$form_id_export = 0;
|
||||||
$form_disabled = 0;
|
$form_disabled = 0;
|
||||||
$form_plugin_user = $row["plugin_user"];
|
$form_plugin_user = $row["plugin_user"];
|
||||||
$form_plugin_pass = $row["plugin_pass"];
|
$form_plugin_pass = $row["plugin_pass"];
|
||||||
$form_plugin_parameter = $row["plugin_parameter"];
|
$form_plugin_parameter = $row["plugin_parameter"];
|
||||||
$form_prediction_module = "";
|
$form_prediction_module = "";
|
||||||
$form_id_plugin = "";
|
$form_id_plugin = "";
|
||||||
$form_post_process = "";
|
$form_post_process = "";
|
||||||
} elseif (!isset($_POST['oid'])){
|
|
||||||
// Clean up specific network modules fields
|
} elseif (!isset($_POST['oid'])) {
|
||||||
$form_name = "";
|
// Clean up specific network modules fields
|
||||||
$form_description = "";
|
$form_name = "";
|
||||||
$form_id_module_group = 1;
|
$form_description = "";
|
||||||
$form_id_tipo_modulo = 1;
|
$form_id_module_group = 1;
|
||||||
$form_post_process = "";
|
$form_id_tipo_modulo = 1;
|
||||||
$form_max_timeout = "";
|
$form_post_process = "";
|
||||||
$form_minvalue = "";
|
$form_max_timeout = "";
|
||||||
$form_maxvalue = "";
|
$form_minvalue = "";
|
||||||
$form_interval = "";
|
$form_maxvalue = "";
|
||||||
$form_prediction_module = "";
|
$form_interval = "";
|
||||||
$form_id_plugin = "";
|
$form_prediction_module = "";
|
||||||
$form_id_export = "";
|
$form_id_plugin = "";
|
||||||
$form_disabled= "0";
|
$form_id_export = "";
|
||||||
$form_tcp_send = "";
|
$form_disabled= "0";
|
||||||
$form_tcp_rcv = "";
|
$form_tcp_send = "";
|
||||||
$form_tcp_port = "";
|
$form_tcp_rcv = "";
|
||||||
$form_snmp_community = "public";
|
$form_tcp_port = "";
|
||||||
$form_snmp_oid = "";
|
$form_snmp_community = "public";
|
||||||
$form_ip_target = $direccion_agente; // taken from configurar_agente.php
|
$form_snmp_oid = "";
|
||||||
$form_plugin_user = "";
|
$form_ip_target = $direccion_agente; // taken from configurar_agente.php
|
||||||
$form_plugin_pass = "";
|
$form_plugin_user = "";
|
||||||
$form_plugin_parameter = "";
|
$form_plugin_pass = "";
|
||||||
|
$form_plugin_parameter = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data Server
|
switch ($form_moduletype) {
|
||||||
if ($form_moduletype == "dataserver"){
|
case "dataserver":
|
||||||
include $config["homedir"]."/godmode/agentes/module_manager_editor_data.php";
|
include $config["homedir"]."/godmode/agentes/module_manager_editor_data.php";
|
||||||
|
break;
|
||||||
|
case "networkserver":
|
||||||
|
include $config["homedir"]."/godmode/agentes/module_manager_editor_network.php";
|
||||||
|
break;
|
||||||
|
case "pluginserver":
|
||||||
|
include $config["homedir"]."/godmode/agentes/module_manager_editor_plugin.php";
|
||||||
|
break;
|
||||||
|
case "predictionserver":
|
||||||
|
include $config["homedir"]."/godmode/agentes/module_manager_editor_prediction.php";
|
||||||
|
break;
|
||||||
|
case "wmiserver":
|
||||||
|
include $config["homedir"]."/godmode/agentes/module_manager_editor_wmi.php";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo '<h3 class="error">DEBUG: Invalid module type specified in '.__FILE__.':'.__LINE__.'</h3>';
|
||||||
|
echo 'Most likely you have recently upgraded from an earlier version of Pandora and either <br />
|
||||||
|
1) forgot to use the database converter<br />
|
||||||
|
2) used a bad version of the database converter (see Bugreport #2124706 for the solution)<br />
|
||||||
|
3) found a new bug - please report a way to duplicate this error';
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
// Network server
|
|
||||||
if ($form_moduletype == "networkserver"){
|
|
||||||
include $config["homedir"]."/godmode/agentes/module_manager_editor_network.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Plugin server
|
|
||||||
if ($form_moduletype == "pluginserver"){
|
|
||||||
include $config["homedir"]."/godmode/agentes/module_manager_editor_plugin.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prediction server
|
|
||||||
if ($form_moduletype == "predictionserver"){
|
|
||||||
include $config["homedir"]."/godmode/agentes/module_manager_editor_prediction.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
// WMI server
|
|
||||||
if ($form_moduletype == "wmiserver"){
|
|
||||||
include $config["homedir"]."/godmode/agentes/module_manager_editor_wmi.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -16,172 +16,174 @@
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// General startup for established session
|
// General startup for established session
|
||||||
global $config;
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
// get the variable form_moduletype
|
// get the variable form_moduletype
|
||||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||||
// get the module to update
|
// get the module to update
|
||||||
$update_module_id = get_parameter_get ("update_module");
|
$update_module_id = get_parameter_get ("update_module",NULL);
|
||||||
// the variable that checks whether the module is disabled or not must be setcommitedversion
|
// the variable that checks whether the module is disabled or not must be setcommitedversion
|
||||||
$disabled_status = NULL;
|
$disabled_status = false;
|
||||||
|
|
||||||
// Specific ACL check
|
// Specific ACL check
|
||||||
if (give_acl ($config["id_user"], 0, "AW")!=1) {
|
if (give_acl ($config["id_user"], 0, "AW")!=1) {
|
||||||
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
||||||
require ($config["homedir"]."/general/noaccess.php");
|
require ($config["homedir"]."/general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether we are updataing and get data if so
|
// Check whether we are updataing and get data if so
|
||||||
if ($update_module_id != NULL){
|
if ($update_module_id != NULL){
|
||||||
$row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id);
|
$row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id);
|
||||||
if ($row == 0){
|
if (empty ($row))
|
||||||
unmanaged_error("Cannot load tnetwork_component reference from previous page");
|
unmanaged_error("Cannot load tnetwork_component reference from previous page");
|
||||||
}
|
|
||||||
else{
|
$id_agente = $row['id_agente'];
|
||||||
$id_agente = $row['id_agente'];
|
$form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter
|
||||||
$form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter
|
$form_description = $row['descripcion'];
|
||||||
$form_description = $row['descripcion'];
|
$form_name = $row['nombre'];
|
||||||
$form_name = $row['nombre'];
|
$form_minvalue = $row['min'];
|
||||||
$form_minvalue = $row['min'];
|
$form_maxvalue = $row['max'];
|
||||||
$form_maxvalue = $row['max'];
|
$form_interval = $row['module_interval'];
|
||||||
$form_interval = $row['module_interval'];
|
$form_tcp_port = $row['tcp_port'];
|
||||||
$form_tcp_port = $row['tcp_port'];
|
$form_tcp_send = $row['tcp_send'];
|
||||||
$form_tcp_send = $row['tcp_send'];
|
$form_tcp_rcv = $row['tcp_rcv'];
|
||||||
$form_tcp_rcv = $row['tcp_rcv'];
|
$form_snmp_community = $row['snmp_community'];
|
||||||
$form_snmp_community = $row['snmp_community'];
|
$form_snmp_oid = $row['snmp_oid'];
|
||||||
$form_snmp_oid = $row['snmp_oid'];
|
$form_ip_target = $row['ip_target'];
|
||||||
$form_ip_target = $row['ip_target'];
|
$form_id_module_group = $row['id_module_group'];
|
||||||
$form_id_module_group = $row['id_module_group'];
|
$form_flag = $row['flag'];
|
||||||
$form_flag = $row['flag'];
|
$tbl_id_modulo = $row['id_modulo']; // It doesn't matter
|
||||||
$tbl_id_modulo = $row['id_modulo']; // It doesn't matter
|
$tbl_disabled = $row['disabled'];
|
||||||
$tbl_disabled = $row['disabled'];
|
$form_id_export = $row['id_export'];
|
||||||
$form_id_export = $row['id_export'];
|
$form_plugin_user = $row['plugin_user'];
|
||||||
$form_plugin_user = $row['plugin_user'];
|
$form_plugin_pass = $row['plugin_pass'];
|
||||||
$form_plugin_pass = $row['plugin_pass'];
|
$form_plugin_parameter = $row['plugin_parameter'];
|
||||||
$form_plugin_parameter = $row['plugin_parameter'];
|
$form_id_plugin = $row['id_plugin'];
|
||||||
$form_id_plugin = $row['id_plugin'];
|
$form_post_process = $row['post_process'];
|
||||||
$form_post_process = $row['post_process'];
|
$form_prediction_module = $row['prediction_module'];
|
||||||
$form_prediction_module = $row['prediction_module'];
|
$form_max_timeout = $row['max_timeout'];
|
||||||
$form_max_timeout = $row['max_timeout'];
|
|
||||||
|
|
||||||
if ($tbl_disabled == 1){
|
if ($tbl_disabled == 1)
|
||||||
$disabled_status = 'checked="ckecked"';
|
$disabled_status = true;
|
||||||
} else {
|
|
||||||
$disabled_status = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<h3>". __('Module assignment')." - ". __('Data server module')."</h3>";
|
echo "<h3>".__('Module assignment')." - ".__('Data server module')."</h3>";
|
||||||
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'&form_moduletype='.$form_moduletype.'">';
|
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'&form_moduletype='.$form_moduletype.'">';
|
||||||
|
|
||||||
// Whether in update or insert mode
|
// Whether in update or insert mode
|
||||||
if ($update_module_id == NULL){
|
if ($update_module_id == NULL) {
|
||||||
echo "<input type='hidden' name='insert_module' value='1'>";
|
print_input_hidden ("insert_module", 1);
|
||||||
} else {
|
} else {
|
||||||
echo "<input type='hidden' name='update_module' value='1'>";
|
print_input_hidden ("update_module", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//id_agente_module
|
//id_agente_module
|
||||||
echo "<input type='hidden' name='id_agente_modulo'' value='".$update_module_id."'>";
|
print_input_hidden ("id_agente_modulo", $update_module_id);
|
||||||
|
|
||||||
// id_modulo 1 - Dataserver
|
// id_modulo 1 - Dataserver
|
||||||
echo "<input type='hidden' name='form_id_modulo' value='1'>";
|
print_input_hidden ("form_id_modulo", 1);
|
||||||
echo '<table width="600" cellpadding="4" cellspacing="4" class="databox_color">';
|
echo '<table width="600" cellpadding="4" cellspacing="4" class="databox_color">';
|
||||||
echo '<tr>';
|
echo '<tr><td class="datos2">'. __('Module name').'</td><td class="datos2">';
|
||||||
echo '<td class="datos2">'. __('Module name')."</td>";
|
print_input_text ("form_name", $form_name, '', 35);
|
||||||
echo '<td class="datos2"><input type="text" name="form_name" size="35" value="'.$form_name.'"></td>';
|
echo '</td><td class="datos2">'. __('Disabled').'</td><td class="datos2">';
|
||||||
echo '<td class="datos2">'. __('Disabled')."</td>";
|
print_checkbox ("form_disabled", 1, $disabled_status);
|
||||||
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value="1" "'.$disabled_status.'"></td>';
|
echo '</td></tr>';
|
||||||
echo '</tr><tr>';
|
|
||||||
|
|
||||||
// module type / max timeout
|
// module type / max timeout
|
||||||
echo '</tr><tr>';
|
echo '<tr><td class="datos2">'.__('Module type');
|
||||||
echo '<td class="datos2">'.__('Module type');
|
|
||||||
pandora_help("module_type");
|
pandora_help("module_type");
|
||||||
echo '</td>';
|
echo '</td><td class="datos2" colspan="3">';
|
||||||
echo '<td class="datos2" colspan="3">';
|
|
||||||
|
|
||||||
if ($update_module_id != NULL){
|
if ($update_module_id != NULL){
|
||||||
echo "<span class='redi'>Not available in edition mode</span>";
|
//We don't pass it along as hidden anymore because the update query
|
||||||
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
|
//doesn't need that specific value to change.
|
||||||
|
echo '<span class="redi">Not available in edition mode</span>';
|
||||||
} else {
|
} else {
|
||||||
echo '<select name="form_id_tipo_modulo">';
|
$sql = "SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (0,1,2,6,7,8,9,-1) ORDER BY categoria, nombre";
|
||||||
$sql1 = 'SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (0,1,2,9,6,7,8,-1) ORDER BY categoria, nombre';
|
$result = get_db_all_rows_sql ($sql); //This database is always filled
|
||||||
$result=mysql_query($sql1);
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
foreach ($result as $row) {
|
||||||
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
|
$fields[$row["id_tipo"]] = $row["nombre"];
|
||||||
}
|
}
|
||||||
echo '</select>';
|
print_select ($fields, "form_id_tipo_modulo", '', '', '', '', false, false, false);
|
||||||
}
|
}
|
||||||
echo '</tr>';
|
echo '</td></tr>';
|
||||||
|
|
||||||
// Post process / Export server
|
// Post process / Export server
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="datos2">'.__('Post process');
|
echo '<td class="datos2">'.__('Post process');
|
||||||
pandora_help("postprocess");
|
pandora_help("postprocess");
|
||||||
echo '</td>';
|
echo '</td><td class="datos2">';
|
||||||
echo '<td class="datos2"><input type="text" name="form_post_process" size="5" value="'.$form_post_process.'"></td>';
|
print_input_text ("form_post_process",$form_post_process, '', 5);
|
||||||
echo '<td class="datos2">'.__('Export target')."</td>";
|
echo '</td><td class="datos2">'.__('Export target').'</td>';
|
||||||
echo '<td class="datos2"><select name="form_id_export">';
|
echo '<td class="datos2">';
|
||||||
if ($form_id_export != 0){
|
|
||||||
echo "<option value='".$form_id_export."'>".dame_nombre_servidorexportacion($form_id_export)."</option>";
|
$fields = array ();
|
||||||
|
$sql = "SELECT id, name FROM tserver_export ORDER BY name";
|
||||||
|
$result = get_db_all_rows_sql ($sql);
|
||||||
|
|
||||||
|
if ($result === false)
|
||||||
|
$result = array ();
|
||||||
|
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$fields[$row["id"]] = $row["name"];
|
||||||
}
|
}
|
||||||
echo "<option value='0'>".__('None')."</option>";
|
|
||||||
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
|
print_select ($fields, "form_id_export", $form_id_export,'',__('None'),'0', false, false, false);
|
||||||
$result=mysql_query($sql1);
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
echo '</td></tr>';
|
||||||
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
|
|
||||||
}
|
|
||||||
echo "</select>";
|
|
||||||
echo '</tr>';
|
|
||||||
|
|
||||||
// Max / min value
|
// Max / min value
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="datos">'.__('Min. Value')."</td>";
|
echo '<td class="datos">'.__('Min. Value').'</td>';
|
||||||
echo '<td class="datos"><input type="text" name="form_minvalue" size="5" value="'.$form_minvalue.'"></td>';
|
echo '<td class="datos">';
|
||||||
echo '<td class="datos">'.__('Max. Value')."</td>";
|
print_input_text ("form_minvalue",$form_minvalue,'',5);
|
||||||
echo '<td class="datos"><input type="text" name="form_maxvalue" size="5" value="'.$form_maxvalue.'"></td>';
|
echo '</td><td class="datos">'.__('Max. Value').'</td>';
|
||||||
echo '</tr>';
|
echo '<td class="datos">';
|
||||||
|
print_input_text ("form_maxvalue",$form_maxvalue,'',5);
|
||||||
|
echo '</td></tr>';
|
||||||
|
|
||||||
// Interval & id_module_group
|
// Interval & id_module_group
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="datos2">'.__('Interval')."</td>";
|
echo '<td class="datos2">'.__('Interval').'</td>';
|
||||||
echo '<td class="datos2"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td>';
|
echo '<td class="datos2"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td>';
|
||||||
echo '<td class="datos2">'.__('Module group')."</td>";
|
echo '<td class="datos2">'.__('Module group').'</td>';
|
||||||
echo '<td class="datos2">';
|
echo '<td class="datos2">';
|
||||||
echo '<select name="form_id_module_group">';
|
|
||||||
if ($form_id_module_group != 0){
|
$fields = array ();
|
||||||
echo "<option value='".$form_id_module_group."'>".dame_nombre_grupomodulo($form_id_module_group)."</option>";
|
$sql = "SELECT id_mg, name FROM tmodule_group";
|
||||||
|
$result = get_db_all_rows_sql ($sql);
|
||||||
|
|
||||||
|
if ($result === false)
|
||||||
|
$result = array ();
|
||||||
|
|
||||||
|
$fields[0] = __("Not assigned");
|
||||||
|
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$fields[$row["id_mg"]] = $row["name"];
|
||||||
}
|
}
|
||||||
$sql1='SELECT * FROM tmodule_group';
|
|
||||||
$result=mysql_query($sql1);
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
print_select ($fields, "form_id_module_group", $form_id_module_group,'','','',false,false,false);
|
||||||
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
|
echo '</td></tr>';
|
||||||
}
|
|
||||||
echo '</select>';
|
|
||||||
echo '</tr>';
|
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td valign="top" class="datos">'.__('Description')."</td>";
|
echo '<td valign="top" class="datos">'.__('Description')."</td>";
|
||||||
echo '<td valign="top" class="datos" colspan="3"><textarea name="form_description" cols="65" rows="2">'.$form_description.'</textarea>';
|
echo '<td valign="top" class="datos" colspan="3">';
|
||||||
echo '</tr>';
|
print_textarea ("form_description", 2, 65, $form_description);
|
||||||
|
echo '</td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
//Submit
|
//Submit
|
||||||
echo '<table width="600" cellpadding="4" cellspacing="4">';
|
echo '<table width="600" cellpadding="4" cellspacing="4">';
|
||||||
echo '<td valign="top" align="right">';
|
echo '<td valign="top" align="right">';
|
||||||
if ($update_module_id == NULL){
|
if ($update_module_id == NULL){
|
||||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.__('Create').'">';
|
print_submit_button (__('Create'), "crtbutton", false,'class="sub wand"');
|
||||||
} else {
|
} else {
|
||||||
echo '<input name="updbutton" type="submit" class="sub wand" value="'.__('Update').'">';
|
print_submit_button (__('Update'), "updbutton", false,'class="sub wand"');
|
||||||
}
|
}
|
||||||
echo '</table>';
|
echo '</td></tr></table>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue