$id_agente, 'id_tipo_modulo' => $row2["type"], 'descripcion' => $row2["description"], 'nombre' => $row2["name"], 'max' => $row2["max"], 'min' => $row2["min"], 'module_interval' => $row2["module_interval"], 'tcp_port' => $row2["tcp_port"], 'tcp_send' => $row2["tcp_send"], 'tcp_rcv' => $row2["tcp_rcv"], 'snmp_community' => $row2["snmp_community"], 'snmp_oid' => $row2["snmp_oid"], 'ip_target' => $direccion_agente, 'id_module_group' => $row2["id_module_group"], 'id_modulo' => $row2["id_modulo"], 'plugin_user' => $row2["plugin_user"], 'plugin_pass' => $row2["plugin_pass"], 'plugin_parameter' => $row2["plugin_parameter"], 'max_timeout' => $row2["max_timeout"], 'id_plugin' => $row2['id_plugin']); $id_agente_modulo = process_sql_insert('tagente_modulo', $values); // Create with different estado if proc type or data type if ($id_agente_modulo !== false) { $values = array( 'id_agente_modulo' => $id_agente_modulo, 'datos' => 0, 'timestamp' => '0000-00-00 00:00:00', 'estado' => 0, 'id_agente' => $id_agente, 'utimestamp' => 0); process_sql_insert('tagente_estado', $values); } else { echo '

'.__('Error adding module').'

'; } } } echo '

'.__('Modules successfully added ').'

'; } // Main header echo "

".__('Module templates')."

"; // ========================== // TEMPLATE ASSIGMENT FORM // ========================== echo "

".__('Available templates')."

"; echo '
'; $nps = get_db_all_fields_in_table ("tnetwork_profile", "name"); if ($nps === false) { $nps = array (); } $select = array (); foreach ($nps as $row) { $select[$row["id_np"]] = $row["name"]; } echo '
'.__('Template'); print_select ($select, "template_id"); print_submit_button (__('Assign'), 'crt', false, 'class="sub next"'); echo '
'; // ========================== // MODULE VISUALIZATION TABLE // ========================== echo "

".__('Assigned modules')."

"; switch ($config["dbtype"]) { case "mysql": case "postgresql": $sql = sprintf ("SELECT * FROM tagente_modulo WHERE id_agente = %d AND delete_pending = false ORDER BY id_module_group, nombre", $id_agente); break; case "oracle": $sql = sprintf ("SELECT * FROM tagente_modulo WHERE id_agente = %d AND (delete_pending <> 1 AND delete_pending IS NOT NULL) ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)", $id_agente); break; } $result = get_db_all_rows_sql ($sql); if ($result === false) { $result = array (); } $table->width = 700; $table->cellpadding = 4; $table->cellspacing = 4; $table->class = "databox"; $table->head = array (); $table->data = array (); $table->align = array (); $table->head[0] = __('Module name'); $table->head[1] = __('Type'); $table->head[2] = __('Description'); $table->head[3] = __('Action'); $table->align[1] = "center"; $table->align[3] = "center"; foreach ($result as $row) { $data = array (); $data[0] = $row["nombre"]; if ($row["id_tipo_modulo"] > 0) { $data[1] = print_image("images/" . show_icon_type ($row["id_tipo_modulo"]), true, array("border" => "0")); } else { $data[1] = ''; } $data[2] = mb_substr ($row["descripcion"], 0, 60); $data[3] = '' . print_image("images/cross.png", true, array("border" => "0", "alt" => __('Delete'), "onclick" => "if (!confirm('".__('Are you sure?') . "')) return false;")) . ' '; $data[3] .= '' . print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; array_push ($table->data, $data); } if (!empty ($table->data)) { print_table ($table); unset ($table); } else { echo '
No modules
'; } ?>