diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5ec2768e83..36d506012f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,4 +1,26 @@ -2008-04-03 Sancho Lerena +2008-04-03 Jorge Gonzalez + + * include/functions_db.php: New functions added to handle plugins and + export servers. + + * include/languages/language_en.php: Updated English translation file. + + * general/header.php: Updated header. + + * godmode/agentes/manage_config.php, + godmode/agentes/module_manager_editor_data.php, + godmode/agentes/module_manager_editor_network.php, + godmode/agentes/module_manager.php, + godmode/agentes/modificar_agente.php, + godmode/agentes/module_manager_editor_wmi.php, + godmode/agentes/configurar_agente.php, + godmode/agentes/module_manager_editor_plugin.php, + godmode/agentes/module_manager_editor.php, + godmode/agentes/module_manager_editor_prediction.php, + godmode/agentes/agent_manager.php, godmode/modules/module_list.php: + Added infrastructure to add/edit modules. + +2008-04-03 Sancho Lerena * pandoradb_data.sql: IA to prediction in description. diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index f36267a829..80690b4362 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -25,6 +25,7 @@ echo ' '; echo "
"; + echo ""; if (isset ($_SESSION["id_usuario"])){ diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 7c66c444c6..078e13940b 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -3,6 +3,7 @@ // Pandora FMS - the Free Monitoring System // ======================================== // Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +// Copyright (c) 2008 Jorge Gonzalez // Please see http://pandora.sourceforge.net for full contribution list // This program is free software; you can redistribute it and/or diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index efcc391df1..75a4e28cbe 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -2,6 +2,7 @@ // Pandora FMS - the Free Monitoring System // ======================================== // Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +// Copyright (c) 2008 Jorge Gonzalez // Please see http://pandora.sourceforge.net for full contribution list // This program is free software; you can redistribute it and/or @@ -33,9 +34,10 @@ else { } // Get passed variables -$tab = get_parameter_get("tab","main"); +$tab = get_parameter_get ("tab","main"); $form_moduletype = get_parameter_post ("form_moduletype"); $form_alerttype = get_parameter ("form_alerttype"); +$moduletype = get_parameter_get ("moduletype"); // Init vars $descripcion = ""; @@ -98,7 +100,7 @@ $alert_priority = "0"; // ================================ // Create AGENT // ================================ -// We need to create agent BEFORE show tabs, because we need to get agent_id +// We need to create agent BEFORE showing tabs, because we need to get agent_id // This is not very clean, but... if ( isset ($_POST["create_agent"])) { // Create a new and shining agent $nombre_agente = entrada_limpia ($_POST["agente"]); @@ -108,13 +110,13 @@ if ( isset ($_POST["create_agent"])) { // Create a new and shining agent $comentarios = entrada_limpia ($_POST["comentarios"]); $modo = entrada_limpia ($_POST["modo"]); $id_network_server = get_parameter_post ($_POST["network_server"], 0); - $id_plugin_server = get_parameter_post ($_POST["plugin_server"], 0); - $id_prediction_server = get_parameter_post ($_POST["prediction_server"], 0); - $id_wmi_server = get_parameter_post ($_POST["wmi_server"], 0); + $id_plugin_server = get_parameter_post ($_POST["plugin_server"], 0); + $id_prediction_server = get_parameter_post ($_POST["prediction_server"], 0); + $id_wmi_server = get_parameter_post ($_POST["wmi_server"], 0); $id_os = entrada_limpia ($_POST["id_os"]); $disabled = entrada_limpia ($_POST["disabled"]); - // Check if agent exists (BUG WC-50518-2 ) + // Check if agent exists (BUG WC-50518-2) $sql1='SELECT nombre FROM tagente WHERE nombre = "'.$nombre_agente.'"'; $result=mysql_query($sql1); if ($row=mysql_fetch_array($result)){ @@ -449,10 +451,10 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter $modo = entrada_limpia($_POST["modo"]); $id_os = entrada_limpia($_POST["id_os"]); $disabled = entrada_limpia($_POST["disabled"]); - $id_network_server = get_parameter ("network_server", 0); - $id_plugin_server = get_parameter ("plugin_server", 0); - $id_wmi_server = get_parameter ("wmi_server", 0); - $id_prediction_server = get_parameter ("prediction_server", 0); + $id_network_server = get_parameter ("network_server", 0); + $id_plugin_server = get_parameter ("plugin_server", 0); + $id_wmi_server = get_parameter ("wmi_server", 0); + $id_prediction_server = get_parameter ("prediction_server", 0); if ($direccion_agente != $old_agent_address){ agent_add_address ($id_agente, $direccion_agente); @@ -614,29 +616,29 @@ if ((isset($_POST["update_module"])) || (isset($_POST["insert_module"]))) { } $form_id_tipo_modulo = get_parameter ("form_id_tipo_modulo"); - $form_name = get_parameter ("form_name"); - $form_description = get_parameter ("form_description"); - $form_id_module_group = get_parameter ("form_id_module_group",0); - $form_id_tipo_modulo = get_parameter ("form_id_tipo_modulo"); - $form_post_process = get_parameter ("form_post_process",0); - $form_max_timeout = get_parameter ("form_max_timeout",0); - $form_minvalue = get_parameter_post ("form_minvalue",0); - $form_maxvalue = get_parameter ("form_maxvalue",0); - $form_interval = get_parameter ("form_interval",345345345); - $form_id_prediction_module = get_parameter ("form_id_prediction_module",0); - $form_id_plugin = get_parameter ("form_id_plugin",0); - $form_id_export = get_parameter ("form_id_export",0); - $form_disabled = get_parameter ("form_disabled",0); - $form_tcp_send = get_parameter ("form_tcp_send",""); - $form_tcp_rcv = get_parameter ("form_tcp_rcv",""); - $form_tcp_port = get_parameter ("form_tcp_port",0); - $form_snmp_community = get_parameter ("form_snmp_community","public"); - $form_snmp_oid = get_parameter ("form_snmp_oid",""); - $form_ip_target = get_parameter ("form_ip_target",""); - $form_plugin_user = get_parameter ("form_plugin_user",""); - $form_plugin_pass = get_parameter ("form_plugin_pass",""); - $form_plugin_parameter = get_parameter ("form_plugin_parameter",""); - $form_id_modulo = get_parameter ("form_id_modulo"); + $form_name = get_parameter ("form_name"); + $form_description = get_parameter ("form_description"); + $form_id_module_group = get_parameter ("form_id_module_group",0); + $form_id_tipo_modulo = get_parameter ("form_id_tipo_modulo"); + $form_post_process = get_parameter ("form_post_process",0); + $form_max_timeout = get_parameter ("form_max_timeout",0); + $form_minvalue = get_parameter_post ("form_minvalue",0); + $form_maxvalue = get_parameter ("form_maxvalue",0); + $form_interval = get_parameter ("form_interval",300); + $form_id_prediction_module = get_parameter ("form_id_prediction_module",0); + $form_id_plugin = get_parameter ("form_id_plugin",0); + $form_id_export = get_parameter ("form_id_export",0); + $form_disabled = get_parameter ("form_disabled",0); + $form_tcp_send = get_parameter ("form_tcp_send",""); + $form_tcp_rcv = get_parameter ("form_tcp_rcv",""); + $form_tcp_port = get_parameter ("form_tcp_port",0); + $form_snmp_community = get_parameter ("form_snmp_community","public"); + $form_snmp_oid = get_parameter ("form_snmp_oid",""); + $form_ip_target = get_parameter ("form_ip_target",""); + $form_plugin_user = get_parameter ("form_plugin_user",""); + $form_plugin_pass = get_parameter ("form_plugin_pass",""); + $form_plugin_parameter = get_parameter ("form_plugin_parameter",""); + $form_id_modulo = get_parameter ("form_id_modulo"); } // MODULE UPDATE @@ -649,25 +651,37 @@ if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified } } $sql_update = "UPDATE tagente_modulo - SET max ='".$modulo_max."', - min = '".$modulo_min."', - nombre='".$nombre."', - descripcion='".$descripcion."', - tcp_send = '$tcp_send', - tcp_rcv = '$tcp_rcv', - tcp_port = '$tcp_port', - ip_target = '$ip_target', - snmp_oid = '$snmp_oid', - snmp_community = '$snmp_community', - id_module_group = '$id_module_group', - module_interval = '$module_interval' - WHERE id_agente_modulo = ".$id_agente_modulo; - $result=mysql_query($sql_update); + SET descripcion = '$form_description', + nombre = '$form_name', + max = '$form_maxvalue', + min = '$form_minvalue', + module_interval = '$form_interval', + tcp_port = '$form_tcp_port', + tcp_send = '$form_tcp_send', + tcp_rcv = '$form_tcp_rcv', + snmp_community = '$form_snmp_community', + snmp_oid = '$form_snmp_oid', + ip_target = '$form_ip_target', + id_module_group = '$form_id_module_group', + flag = '$form_flag', + id_modulo = '$form_id_modulo', + disabled = '$form_disabled', + id_export = '$form_id_export', + plugin_user = '$form_plugin_user', + plugin_pass = '$form_plugin_pass', + plugin_parameter = '$form_plugin_parameter', + id_plugin = '$form_id_plugin', + post_process = '$form_post_process', + prediction_module = '$form_prediction_module', + max_timeout = '$form_max_timeout' + WHERE id_agente_modulo = '$id_agente_modulo'"; + $result=mysql_query($sql_update); if (! $result) { echo "

".$lang_label["update_module_no"]."

"; } else { echo "

".$lang_label["update_module_ok"]."

"; } + /* // Init vars to null to avoid trash in forms $id_tipo_modulo = "";$nombre = "";$descripcion = "";$modulo_max = ""; $modulo_min = "";// Pandora 1.2 new module data: @@ -675,14 +689,15 @@ if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified $snmp_oid = "";$snmp_community = "";$id_module_group = ""; $module_interval = ""; $modulo_nombre = ""; $modulo_descripcion = ""; $update_module = 0; + */ } // ========================================================= // OID Refresh button to get SNMPWALK from data in form // This code is also applied when submitting a new module (insert_module = 1) // ========================================================= if (isset($_POST["oid"])){ - snmp_set_quick_print(1); - if (! ($snmpwalk = snmprealwalk($ip_target, $snmp_community, ""))) { + snmp_set_quick_print(1); + if (! ($snmpwalk = snmprealwalk($form_ip_target, $form_snmp_community, ""))) { echo "

".$lang_label["cannot_read_snmp"]."

"; } else { echo "

".$lang_label["ok_read_snmp"]."

"; @@ -694,9 +709,7 @@ if (isset($_POST["oid"])){ // MODULE INSERT // ========================================================= -if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1)) ) && - (!isset($_POST["oid"])) && - (isset($_POST["insert_module"]))){ +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"])) { $combo_snmp_oid = entrada_limpia($_POST["form_combo_snmp_oid"]); @@ -722,12 +735,12 @@ if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1)) ) && $id_agente_modulo = mysql_insert_id(); // Create with different estado if proc type or data type if ( - ($form_id_tipo_modulo == 2) || // data_proc - ($form_id_tipo_modulo == 6) || // icmp_proc - ($form_id_tipo_modulo == 9) || // tcp_proc - ($form_id_tipo_modulo == 18) || //snmp proc - ($form_id_tipo_modulo == 21) || // async proc - ($form_id_tipo_modulo == 100) // Keepalive + ($form_id_tipo_modulo == 2) || // data_proc + ($form_id_tipo_modulo == 6) || // icmp_proc + ($form_id_tipo_modulo == 9) || // tcp_proc + ($form_id_tipo_modulo == 18) || //snmp proc + ($form_id_tipo_modulo == 21) || // async proc + ($form_id_tipo_modulo == 100) // Keepalive ){ $sql_insert2 = "INSERT INTO tagente_estado (id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp) @@ -787,23 +800,23 @@ if (isset($_GET["delete_module"])){ // DELETE agent module ! // ----------------------------------- switch ($tab) { -case "main": require "agent_manager.php"; + case "main": + require "agent_manager.php"; break; -case "module": - if ($form_moduletype == "") - require "module_manager.php"; - else - require "module_manager_editor.php"; + case "module": + if (($form_moduletype == "") && ($moduletype == "")) + require "module_manager.php"; + else + require "module_manager_editor.php"; break; -case "alert": + case "alert": if (($form_alerttype == "") AND (!isset($_GET["update_alert"]))) require "alert_manager.php"; else require "alert_manager_editor.php"; break; -case "template":require "agent_template.php"; + case "template": + require "agent_template.php"; break; } - - ?> diff --git a/pandora_console/godmode/agentes/manage_config.php b/pandora_console/godmode/agentes/manage_config.php index aa420952bf..3c187186e2 100644 --- a/pandora_console/godmode/agentes/manage_config.php +++ b/pandora_console/godmode/agentes/manage_config.php @@ -5,6 +5,7 @@ // Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com // Copyright (c) 2005-2006 Artica Soluciones Tecnol�icas S.L, info@artica.es // Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com +// Copyright (c) 2008 Jorge Gonzalez // 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 diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 4bafa7f517..c032e7133b 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -2,6 +2,7 @@ // Pandora FMS - the Free Monitoring System // ======================================== // Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +// Copyright (c) 2008 Jorge Gonzalez // Please see http://pandora.sourceforge.net for full contribution list // This program is free software; you can redistribute it and/or diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 6b5028a17c..03b5b829d7 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -2,6 +2,7 @@ // Pandora FMS - the Free Monitoring System // ======================================== // Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com +// Copyright (c) 2008 Jorge Gonzalez // Main PHP/SQL code development, project architecture and management. // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -77,18 +78,18 @@ if ($row=mysql_num_rows($result)){ echo "
"; echo ""; echo ""; - $color=1;$last_modulegroup = "0"; - while ($row=mysql_fetch_array($result)){ + $color=1; $last_modulegroup = "0"; + while ($row = mysql_fetch_array($result)){ if ($color == 1){ - $tdcolor="datos"; - $color =0; + $tdcolor = "datos"; + $color = 0; } else { - $tdcolor="datos2"; - $color =1; + $tdcolor = "datos2"; + $color = 1; } $id_tipo = $row["id_tipo_modulo"]; $id_module = $row["id_modulo"]; - $nombre_modulo =$row["nombre"]; + $nombre_modulo = $row["nombre"]; $descripcion = $row["descripcion"]; $module_max = $row["max"]; $module_min = $row["min"]; @@ -139,7 +140,8 @@ if ($row=mysql_num_rows($result)){ echo "'; echo ""; echo " "; - echo ""; + // Update module + echo ""; echo ""; // Make a data normalization @@ -151,5 +153,6 @@ if ($row=mysql_num_rows($result)){ } } echo "
".$lang_label["description"]."".$lang_label["max_min"]."".$lang_label["action"]."
"; + } else echo "
".lang_string("No available data to show")."
"; diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index dd144e9130..b89dd17d38 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -2,6 +2,7 @@ // Pandora FMS - the Free Monitoring System // ======================================== // Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com +// Copyright (c) 2008 Jorge Gonzalez // Main PHP/SQL code development, project architecture and management. // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -21,15 +22,38 @@ if (give_acl($config["id_user"], 0, "AW")!=1) { // Following variables come from module_manager.php -> configurar_agente.php : // -// $form_moduletype: could be networkserver, pluginserver, wmiserver, or 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 + +if (($form_moduletype == "") && ($moduletype != "")){ + switch ($moduletype) { + case "1": + $form_moduletype = "dataserver"; + break; + case "2": + $form_moduletype = "networkserver"; + break; + case "4": + $form_moduletype = "pluginserver"; + break; + case "5": + $form_moduletype = "predictionserver"; + break; + case "6": + $form_moduletype = "wmiserver"; + break; + } +} // Get form (GET) $form_network_component = get_parameter_get("form_network_component", ""); +if($form_network_component == "") + $form_network_component = get_parameter_post("form_network_component", ""); // Using network component to fill some fields -if (($form_moduletype == "networkserver") && ($form_network_component != "")){ +if (($form_moduletype == "networkserver") && ($form_network_component != "") && (!isset($_POST['crtbutton'])) && (!isset($_POST['oid']))){ // 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){ unmanaged_error("Cannot load tnetwork_component reference from previous page"); } @@ -85,14 +109,9 @@ if (($form_moduletype == "networkserver") && ($form_network_component != "")){ $form_plugin_parameter = ""; } -// WMI server -if ($form_moduletype == "wmiserver"){ - include $config["homedir"]."/godmode/agentes/module_manager_editor_wmi.php"; -} - -// Plugin server -if ($form_moduletype == "pluginserver"){ - include $config["homedir"]."/godmode/agentes/module_manager_editor_plugin.php"; +// Data Server +if ($form_moduletype == "dataserver"){ + include $config["homedir"]."/godmode/agentes/module_manager_editor_data.php"; } // Network server @@ -100,9 +119,9 @@ if ($form_moduletype == "networkserver"){ include $config["homedir"]."/godmode/agentes/module_manager_editor_network.php"; } -// Data Server -if ($form_moduletype == "dataserver"){ - include $config["homedir"]."/godmode/agentes/module_manager_editor_data.php"; +// Plugin server +if ($form_moduletype == "pluginserver"){ + include $config["homedir"]."/godmode/agentes/module_manager_editor_plugin.php"; } // Prediction server @@ -110,3 +129,8 @@ 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"; +} + diff --git a/pandora_console/godmode/agentes/module_manager_editor_data.php b/pandora_console/godmode/agentes/module_manager_editor_data.php index 2c5d802c0c..3c6a38024f 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_data.php +++ b/pandora_console/godmode/agentes/module_manager_editor_data.php @@ -2,6 +2,7 @@ // Pandora FMS - the Free Monitoring System // ======================================== // Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +// Copyright (c) 2008 Jorge Gonzalez // Please see http://pandora.sourceforge.net for full contribution list // This program is free software; you can redistribute it and/or @@ -20,6 +21,11 @@ global $config; check_login(); +// get the variable form_moduletype +$form_moduletype = get_parameter_post ("form_moduletype"); +// get the module to update +$update_module_id = get_parameter_get ("update_module"); + // Specific ACL check if (give_acl ($config["id_user"], 0, "AW")!=1) { audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager"); @@ -27,9 +33,60 @@ if (give_acl ($config["id_user"], 0, "AW")!=1) { exit; } -echo "

". lang_string ("module_assigment")." - ". lang_string("data server module")."

"; -echo '
'; -echo ''; +// Check whether we are updataing and get data if so +if ($update_module_id != NULL){ + echo "

UMid $update_module_id

"; + $row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id); + if ($row == 0){ + unmanaged_error("Cannot load tnetwork_component reference from previous page"); + } + else{ + $id_agente = $row['id_agente']; + $form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter + $form_description = $row['descripcion']; + $form_name = $row['nombre']; + $form_minvalue = $row['max']; + $form_maxvalue = $row['min']; + $form_interval = $row['module_interval']; + $form_tcp_port = $row['tcp_port']; + $form_tcp_send = $row['tcp_send']; + $form_tcp_rcv = $row['tcp_rcv']; + $form_snmp_community = $row['snmp_community']; + $form_snmp_oid = $row['snmp_oid']; + $form_ip_target = $row['ip_target']; + $form_id_module_group = $row['id_module_group']; + $tbl_flag = $row['flag']; // It doesn't matter + $tbl_id_modulo = $row['id_modulo']; // It doesn't matter + $tbl_disabled = $row['disabled']; + $form_id_export = $row['id_export']; + $form_plugin_user = $row['plugin_user']; + $form_plugin_pass = $row['plugin_pass']; + $form_plugin_parameter = $row['plugin_parameter']; + $form_id_plugin = $row['id_plugin']; // It doesn't matter + $form_post_process = $row['post_process']; + $tbl_prediction_module = $row['prediction_module']; // It doesn't matter + $form_max_timeout = $row['max_timeout']; + + if ($tbl_disabled == 1){ + $disabled_status = 'checked="ckecked"'; + } else { + $disabled_status = NULL; + } + } +} + +echo "

". lang_string ("module_assignment")." - ". lang_string("data server module")."

"; +echo ''; +// Whether in update or insert mode +if ($update_module_id == NULL){ + echo ""; +} else { + echo ""; +} + +//id_agente_module +echo ""; + // id_modulo 1 - Dataserver echo ""; echo ''; @@ -37,28 +94,39 @@ echo ''; echo '"; echo ''; echo '"; -echo ''; +echo ''; echo ''; +// module type / max timeout +echo ''; echo '"; echo '"; +echo ''; // Post process / Export server -echo ""; +echo ''; echo '"; echo '"; echo '"; echo ''; // Description -echo ''; +echo ''; echo '"; -echo ''; +echo '
'. lang_string ("module_name")."'. lang_string ("disabled")."
'. lang_string ("module_type")."'; -echo '"; +} else { + echo ''; } -echo ""; -echo "
'.lang_string ("post_process")."'; pandora_help("postprocess"); echo "'.lang_string ("export_server")."'; +echo '
'.lang_string ("description")."'; +echo ''; +echo '
'; -echo ""; -echo ""; +//Submit echo ''; echo '
'; -echo ''; -echo "
"; +if ($update_module_id == NULL){ + echo ''; +} else { + echo ''; +} +echo ''; -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index 59383c3dda..2202d7f339 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -1,17 +1,31 @@ +// Please see http://pandora.sourceforge.net for full contribution list + // 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, version 2. +// as published by the Free Software Foundation for version 2. +// 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. // General startup for established session global $config; check_login(); +// get the variable form_moduletype +$form_moduletype = get_parameter_post ("form_moduletype"); +// get the module to update +$update_module_id = get_parameter_get ("update_module"); + // Specific ACL check if (give_acl($config["id_user"], 0, "AW")!=1) { audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager"); @@ -19,11 +33,62 @@ if (give_acl($config["id_user"], 0, "AW")!=1) { exit; } -echo "

".lang_string ("module_assigment")." - ".lang_string("network server module")."

"; +// Check whether we are updataing and get data if so +if ($update_module_id != NULL){ + echo "

UMid $update_module_id

"; + $row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id); + if ($row == 0){ + unmanaged_error("Cannot load tnetwork_component reference from previous page"); + } + else{ + $id_agente = $row['id_agente']; + $form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter + $form_description = $row['descripcion']; + $form_name = $row['nombre']; + $form_minvalue = $row['max']; + $form_maxvalue = $row['min']; + $form_interval = $row['module_interval']; + $form_tcp_port = $row['tcp_port']; + $form_tcp_send = $row['tcp_send']; + $form_tcp_rcv = $row['tcp_rcv']; + $form_snmp_community = $row['snmp_community']; + $form_snmp_oid = $row['snmp_oid']; + $form_ip_target = $row['ip_target']; + $form_id_module_group = $row['id_module_group']; + $tbl_flag = $row['flag']; // It doesn't matter + $tbl_id_modulo = $row['id_modulo']; // It doesn't matter + $tbl_disabled = $row['disabled']; + $form_id_export = $row['id_export']; + $form_plugin_user = $row['plugin_user']; + $form_plugin_pass = $row['plugin_pass']; + $form_plugin_parameter = $row['plugin_parameter']; + $form_id_plugin = $row['id_plugin']; // It doesn't matter + $form_post_process = $row['post_process']; + $tbl_prediction_module = $row['prediction_module']; // It doesn't matter + $form_max_timeout = $row['max_timeout']; + + if ($tbl_disabled == 1){ + $disabled_status = 'checked="ckecked"'; + } else { + $disabled_status = NULL; + } + } +} + +echo "

".lang_string ("module_assignment")." - ".lang_string("network server module")."

"; echo ''; // Create from Network Component -echo ''; -echo ''; +echo ''; +// Whether in update or insert mode +if ($update_module_id == NULL){ + echo ""; +} else { + echo ""; +} + +//id_agente_module +echo ""; + // id_modulo 2 - Network echo ""; @@ -31,30 +96,41 @@ echo ""; echo ""; +echo ''; echo ''; echo '"; echo ''; echo '"; -echo ''; -echo ""; +echo ''; +echo ''; // Ip target, tcp port -echo ""; +echo ''; echo '"; echo ''; echo '"; @@ -65,13 +141,20 @@ echo ''; echo ''; echo '"; echo '"; echo ''; @@ -104,7 +187,7 @@ if (isset($_POST["oid"])){ // y el cabron de PHP me devuelve indices a partir de 1 !!!!!!! //echo "$i: $a[$i]
\n"; $snmp_output = substr($i,0,35)." - ".substr($snmpwalk[$i],0,20); - echo ""; + echo ""; } } echo ""; @@ -135,13 +218,16 @@ pandora_help("postprocess"); echo ""; echo '"; echo ''; // tcp send / rcv value @@ -153,15 +239,20 @@ echo '
"; echo lang_string ("using_network_component"); echo ""; -echo '"; +} else { + echo '"; } -echo "'; +echo ''; +if ($update_module_id == NULL){ echo ''; +} // Name / IP_target echo '
'.lang_string ("module_name")."'.lang_string ("disabled")."
'.lang_string ("ip_target")."'.lang_string ("tcp_port")."
'.lang_string ("module_type")."'; -echo '"; +} else { + echo ''; } -echo ""; + echo ''.lang_string ("max_timeout")."
'.lang_string ("export_server").""; +echo ''; echo '
'; -echo "
"; +echo ''; +echo ''; +echo ''; -// SUbmit +// Submit echo ''; echo '
'; -echo ''; -echo "
"; +if ($update_module_id == NULL){ + echo ''; +} else { + echo ''; +} +echo ''; -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/agentes/module_manager_editor_plugin.php b/pandora_console/godmode/agentes/module_manager_editor_plugin.php index a2b0328f03..d630856c39 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_plugin.php +++ b/pandora_console/godmode/agentes/module_manager_editor_plugin.php @@ -1,17 +1,31 @@ +// Please see http://pandora.sourceforge.net for full contribution list + // 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, version 2. +// as published by the Free Software Foundation for version 2. +// 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. // General startup for established session global $config; check_login(); +// get the variable form_moduletype +$form_moduletype = get_parameter_post ("form_moduletype"); +// get the module to update +$update_module_id = get_parameter_get ("update_module"); + // Specific ACL check if (give_acl($config["id_user"], 0, "AW")!=1) { audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager"); @@ -19,10 +33,60 @@ if (give_acl($config["id_user"], 0, "AW")!=1) { exit; } -echo "

".lang_string ("module_assigment")." - ".lang_string("Plugin server module")."

"; +// Check whether we are updataing and get data if so +if ($update_module_id != NULL){ + echo "

UMid $update_module_id

"; + $row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id); + if ($row == 0){ + unmanaged_error("Cannot load tnetwork_component reference from previous page"); + } + else{ + $id_agente = $row['id_agente']; + $form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter + $form_description = $row['descripcion']; + $form_name = $row['nombre']; + $form_minvalue = $row['max']; + $form_maxvalue = $row['min']; + $form_interval = $row['module_interval']; + $form_tcp_port = $row['tcp_port']; + $form_tcp_send = $row['tcp_send']; + $form_tcp_rcv = $row['tcp_rcv']; + $form_snmp_community = $row['snmp_community']; + $form_snmp_oid = $row['snmp_oid']; + $form_ip_target = $row['ip_target']; + $form_id_module_group = $row['id_module_group']; + $tbl_flag = $row['flag']; // It doesn't matter + $tbl_id_modulo = $row['id_modulo']; // It doesn't matter + $tbl_disabled = $row['disabled']; + $form_id_export = $row['id_export']; + $form_plugin_user = $row['plugin_user']; + $form_plugin_pass = $row['plugin_pass']; + $form_plugin_parameter = $row['plugin_parameter']; + $form_id_plugin = $row['id_plugin']; // It doesn't matter + $form_post_process = $row['post_process']; + $tbl_prediction_module = $row['prediction_module']; // It doesn't matter + $form_max_timeout = $row['max_timeout']; + + if ($tbl_disabled == 1){ + $disabled_status = 'checked="ckecked"'; + } else { + $disabled_status = NULL; + } + } +} + +echo "

".lang_string ("module_assignment")." - ".lang_string("Plugin server module")."

"; echo ''; -echo ''; -echo ''; +echo ''; +// Whether in update or insert mode +if ($update_module_id == NULL){ + echo ""; +} else { + echo ""; +} + +//id_agente_module +echo ""; // id_modulo 4 - PLugin echo ""; @@ -32,8 +96,8 @@ echo ''; echo '"; echo ''; echo '"; -echo ''; -echo ""; +echo ''; +echo ''; // Ip target, Plugin Parameter echo ""; @@ -41,13 +105,18 @@ echo '"; echo ''; echo '"; echo ''; echo ''; @@ -62,18 +131,24 @@ echo '"; echo ''; echo ''; - // module type / max timeout echo ''; echo '"; echo '"; echo ''; @@ -110,26 +185,33 @@ pandora_help("postprocess"); echo ""; echo '"; echo ''; // Description -echo ''; -echo '"; -echo '
'.lang_string ("module_name")."'.lang_string ("disabled")."
'.lang_string ("ip_target")."'.lang_string ("plugin")."'; +// Get actual plugin ID and nicename echo '"; +echo ''; echo '
'.lang_string ("Password")."
'.lang_string ("module_type")."'; -echo '"; +} else { + echo ''; } -echo ""; + echo ''.lang_string ("max_timeout")."
'.lang_string ("export_server").""; +echo ''; echo '
'.lang_string ("description")."'; -echo "
"; +echo ''; +echo ''.lang_string ("description").""; +echo ''; +echo ''; +echo ''; -// SUbmit +// Submit echo ''; echo '
'; -echo ''; -echo "
"; +if ($update_module_id == NULL){ + echo ''; +} else { + echo ''; +} +echo ''; - -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/agentes/module_manager_editor_prediction.php b/pandora_console/godmode/agentes/module_manager_editor_prediction.php index dacc58ce11..8c8247018d 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_prediction.php +++ b/pandora_console/godmode/agentes/module_manager_editor_prediction.php @@ -1,17 +1,31 @@ +// Please see http://pandora.sourceforge.net for full contribution list + // 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, version 2. +// as published by the Free Software Foundation for version 2. +// 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. // General startup for established session global $config; check_login(); +// get the variable form_moduletype +$form_moduletype = get_parameter_post ("form_moduletype"); +// get the module to update +$update_module_id = get_parameter_get ("update_module"); + // Specific ACL check if (give_acl($config["id_user"], 0, "AW")!=1) { audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager"); @@ -19,9 +33,60 @@ if (give_acl($config["id_user"], 0, "AW")!=1) { exit; } -echo "

".lang_string ("module_assigment")." - ".lang_string("Prediction server module")."

"; +// Check whether we are updataing and get data if so +if ($update_module_id != NULL){ + echo "

UMid $update_module_id

"; + $row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id); + if ($row == 0){ + unmanaged_error("Cannot load tnetwork_component reference from previous page"); + } + else{ + $id_agente = $row['id_agente']; + $form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter + $form_description = $row['descripcion']; + $form_name = $row['nombre']; + $form_minvalue = $row['max']; + $form_maxvalue = $row['min']; + $form_interval = $row['module_interval']; + $form_tcp_port = $row['tcp_port']; + $form_tcp_send = $row['tcp_send']; + $form_tcp_rcv = $row['tcp_rcv']; + $form_snmp_community = $row['snmp_community']; + $form_snmp_oid = $row['snmp_oid']; + $form_ip_target = $row['ip_target']; + $form_id_module_group = $row['id_module_group']; + $tbl_flag = $row['flag']; // It doesn't matter + $tbl_id_modulo = $row['id_modulo']; // It doesn't matter + $tbl_disabled = $row['disabled']; + $form_id_export = $row['id_export']; + $form_plugin_user = $row['plugin_user']; + $form_plugin_pass = $row['plugin_pass']; + $form_plugin_parameter = $row['plugin_parameter']; + $form_id_plugin = $row['id_plugin']; // It doesn't matter + $form_post_process = $row['post_process']; + $tbl_prediction_module = $row['prediction_module']; // It doesn't matter + $form_max_timeout = $row['max_timeout']; + + if ($tbl_disabled == 1){ + $disabled_status = 'checked="ckecked"'; + } else { + $disabled_status = NULL; + } + } +} + +echo "

".lang_string ("module_assignment")." - ".lang_string("Prediction server module")."

"; echo ''; -echo ''; +// Whether in update or insert mode +if ($update_module_id == NULL){ + echo ""; +} else { + echo ""; +} + +//id_agente_module +echo ""; + // id_modulo 5 - Prediction echo ""; @@ -31,7 +96,7 @@ echo ''; echo ''.lang_string ("module_name").""; echo ''; echo ''.lang_string ("disabled").""; -echo ''; +echo ''; echo ''; @@ -50,25 +115,26 @@ echo ""; echo ""; echo ''.lang_string ("module_type").""; echo ''; -echo '"; +} else { + echo ''; } -echo ""; echo ''.lang_string ("interval").""; -echo ''; - -echo ""; +echo ''; // Post process / Export server -echo ""; - +echo ''; echo ''.lang_string ("module_group").""; -echo ''; -echo ''; if ($form_id_module_group != 0){ echo ""; } @@ -81,26 +147,33 @@ echo ''; echo ''.lang_string ("export_server").""; echo '"; +echo ''; echo ''; - // Description echo ''; -echo ''.lang_string ("description").""; -echo ''; -echo ""; -echo ""; +echo ''.lang_string ("description").""; +echo ''; +echo ''; +echo ''; -echo ''; +// Submit +echo '
'; echo '
'; -echo ''; -echo "
"; +if ($update_module_id == NULL){ + echo ''; +} else { + echo ''; +} +echo ''; -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/agentes/module_manager_editor_wmi.php b/pandora_console/godmode/agentes/module_manager_editor_wmi.php index dcd9bf9233..baaf36c385 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_wmi.php +++ b/pandora_console/godmode/agentes/module_manager_editor_wmi.php @@ -1,17 +1,31 @@ +// Please see http://pandora.sourceforge.net for full contribution list + // 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, version 2. +// as published by the Free Software Foundation for version 2. +// 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. // General startup for established session global $config; check_login(); +// get the variable form_moduletype +$form_moduletype = get_parameter_post ("form_moduletype"); +// get the module to update +$update_module_id = get_parameter_get ("update_module"); + // Specific ACL check if (give_acl($config["id_user"], 0, "AW")!=1) { audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager"); @@ -19,10 +33,60 @@ if (give_acl($config["id_user"], 0, "AW")!=1) { exit; } -echo "

".lang_string ("module_assigment")." - ".lang_string("WMI server module")."

"; +// Check whether we are updataing and get data if so +if ($update_module_id != NULL){ + echo "

UMid $update_module_id

"; + $row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id); + if ($row == 0){ + unmanaged_error("Cannot load tnetwork_component reference from previous page"); + } + else{ + $id_agente = $row['id_agente']; + $form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter + $form_description = $row['descripcion']; + $form_name = $row['nombre']; + $form_minvalue = $row['max']; + $form_maxvalue = $row['min']; + $form_interval = $row['module_interval']; + $form_tcp_port = $row['tcp_port']; + $form_tcp_send = $row['tcp_send']; + $form_tcp_rcv = $row['tcp_rcv']; + $form_snmp_community = $row['snmp_community']; + $form_snmp_oid = $row['snmp_oid']; + $form_ip_target = $row['ip_target']; + $form_id_module_group = $row['id_module_group']; + $tbl_flag = $row['flag']; // It doesn't matter + $tbl_id_modulo = $row['id_modulo']; // It doesn't matter + $tbl_disabled = $row['disabled']; + $form_id_export = $row['id_export']; + $form_plugin_user = $row['plugin_user']; + $form_plugin_pass = $row['plugin_pass']; + $form_plugin_parameter = $row['plugin_parameter']; + $form_id_plugin = $row['id_plugin']; // It doesn't matter + $form_post_process = $row['post_process']; + $tbl_prediction_module = $row['prediction_module']; // It doesn't matter + $form_max_timeout = $row['max_timeout']; + + if ($tbl_disabled == 1){ + $disabled_status = 'checked="ckecked"'; + } else { + $disabled_status = NULL; + } + } +} + +echo "

".lang_string ("module_assignment")." - ".lang_string("WMI server module")."

"; echo ''; -echo ''; -echo ''; +echo ''; +// Whether in update or insert mode +if ($update_module_id == NULL){ + echo ""; +} else { + echo ""; +} + +//id_agente_module +echo ""; // id_modulo 6 - WMI echo ""; @@ -32,11 +96,11 @@ echo ''; echo '"; echo ''; echo '"; -echo ''; -echo ""; +echo ''; +echo ''; // Ip target, WMI query -echo ""; +echo ''; echo '"; echo ''; echo '"; @@ -57,13 +121,19 @@ echo ''; echo ''; echo '"; echo '"; echo ''; @@ -93,33 +163,40 @@ echo ''; echo '"; echo '"; echo '"; echo ''; // Description -echo ''; +echo ''; echo '"; -echo '
'.lang_string ("module_name")."'.lang_string ("disabled")."
'.lang_string ("ip_target")."'.lang_string ("WMI Query")."
'.lang_string ("module_type")."'; -echo '"; +} else { + echo ''; } -echo ""; + echo ''.lang_string ("max_timeout")."
"; +echo '
'.lang_string ("post_process")."'; pandora_help("postprocess"); echo "'.lang_string ("export_server").""; +echo ''; echo '
'.lang_string ("description")."'; -echo "
"; +echo ''; +echo ''; +echo ''; -// SUbmit +// Submit echo ''; echo '
'; -echo ''; -echo "
"; +if ($update_module_id == NULL){ + echo ''; +} else { + echo ''; +} +echo ''; - -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/modules/module_list.php b/pandora_console/godmode/modules/module_list.php index fd29c295e2..eda08ebec3 100644 --- a/pandora_console/godmode/modules/module_list.php +++ b/pandora_console/godmode/modules/module_list.php @@ -105,4 +105,4 @@ else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access module management"); require ("general/noaccess.php"); } -?> \ No newline at end of file +?> diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 3b0a951d72..3107d08e67 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -351,6 +351,36 @@ function dame_nombre_grupomodulo($id){ return $pro; } +// --------------------------------------------------------------- +// Returns name of a export server +// --------------------------------------------------------------- + +function dame_nombre_servidorexportacion($id){ + require("config.php"); + $query1="SELECT id, name FROM tserver_export WHERE id = ".$id; + $resq1=mysql_query($query1); + if ($rowdup=mysql_fetch_array($resq1)) + $pro=$rowdup["name"]; + else + $pro = ""; + return $pro; +} + +// --------------------------------------------------------------- +// Returns name of a plugin module +// --------------------------------------------------------------- + +function dame_nombre_pluginid($id){ + require("config.php"); + $query1="SELECT id, name FROM tplugin WHERE id = ".$id; + $resq1=mysql_query($query1); + if ($rowdup=mysql_fetch_array($resq1)) + $pro=$rowdup["name"]; + else + $pro = ""; + return $pro; +} + // --------------------------------------------------------------- // Returns agent name, given a ID of agente_module table // --------------------------------------------------------------- @@ -1290,7 +1320,6 @@ function lang_string ($string){ return "[".$string."]"; } - function check_server_status (){ global $config; // This check assumes that server_keepalive should be AT LEAST 15 MIN diff --git a/pandora_console/include/languages/language_en.php b/pandora_console/include/languages/language_en.php index 309583ef92..b3f2b70e8f 100644 --- a/pandora_console/include/languages/language_en.php +++ b/pandora_console/include/languages/language_en.php @@ -923,4 +923,4 @@ $lang_label["Source Agent/Alert"]="Source Agent/Alert"; global $lang_label; global $help_label; -?> \ No newline at end of file +?>