diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 3b2b039dca..714da8839f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2008-06-09 Ramon Novoa + + * pandoradb_data.sql: Added missing parenthesis. + * include/styles/pandora.css: Added style for the remote configuration + editor. + * godmode/agentes/agent_disk_conf_editor.php: Added to repository. + Remote configuration editor. + * godmode/agentes/agent_manager.php: Added support to edit remote + agent configurations. + 2008-06-10 Sancho Lerena * pandoradb.sql: Updated tevent structure. Added criticity and diff --git a/pandora_console/godmode/agentes/agent_disk_conf_editor.php b/pandora_console/godmode/agentes/agent_disk_conf_editor.php new file mode 100644 index 0000000000..4a31884897 --- /dev/null +++ b/pandora_console/godmode/agentes/agent_disk_conf_editor.php @@ -0,0 +1,107 @@ + +// 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 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 purpose functions +/////////////////////////////////////////////////////////////////////////////// + +// Displays the configuration in a textarea +function display_config () { + global $agent_md5, $config, $id_agente, $lang_label, $nombre_agente; + + // Read configuration file + $file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf"; + $file = fopen($file_name, "rb"); + $agent_config = fread($file, filesize($file_name)); + fclose($file); + + // Display it + echo '
'; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
' . $lang_label["agent_name"] . ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ''; + echo '
'; + echo ''; + echo ''; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; +} + +// Saves the configuration and the md5 hash +function save_config ($agent_config) { + global $agent_md5, $config; + + // Save configuration + $file = fopen($config["remote_config"] . "/" . $agent_md5 . ".conf", "wb"); + fwrite($file, $agent_config); + fclose($file); + + // Save configuration md5 + $config_md5 = md5($agent_config); + $file = fopen($config["remote_config"] . "/" . $agent_md5 . ".md5", "wb"); + fwrite($file, $config_md5); + fclose($file); +} + +/////////////////////////////////////////////////////////////////////////////// +// Main code +/////////////////////////////////////////////////////////////////////////////// + +// Load global vars +require("include/config.php"); +if (give_acl($id_user, 0, "AW")!=1) { + audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access agent manager"); + require ("general/noaccess.php"); + exit; +}; + +// Update configuration +if (isset($_POST["disk_conf"])) { + save_config(str_replace("\r\n", "\n", stripslashes($_POST["disk_conf"]))); + echo "

" . $lang_label["update_agent_ok"] . "

"; +} + +display_config (); + +// Footer +echo ""; + +?> diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 078e13940b..ace7a7ab79 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -40,6 +40,13 @@ if (isset($_GET["create_agent"])){ echo ""; echo "
"; +// Agent remote configuration editor +$agent_md5 = md5($nombre_agente, FALSE); +if (isset($_GET["disk_conf"])){ + require ("agent_disk_conf_editor.php"); + exit; +} + echo '
'; if ($create_agent == 1) { @@ -60,6 +67,12 @@ if ((isset($id_agente)) && ($id_agente != "")){ sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'> "; } +// Remote configuration available +if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) { + echo " + + "; +} echo ''; echo ''.$lang_label["ip_address"].''; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c6658248ec..e673ed0cc8 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -45,6 +45,13 @@ textarea { font-family: verdana, sans-serif; font-size: 8pt; } +textarea.conf_editor { + padding: 5px; + width: 650; + height: 350; + font-family: verdana, sans-serif; + font-size: 8pt; +} input { padding: 2px 3px 4px 3px; } diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index f9a2868258..fae04a12a1 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -46,7 +46,7 @@ INSERT INTO `talerta` VALUES (10,'Synthetized Speech','flite -t _FIELD2_','Uses /*!40000 ALTER TABLE `tconfig` DISABLE KEYS */; LOCK TABLES `tconfig` WRITE; INSERT INTO `tconfig` VALUES -(1,'language_code','en'),(3,'block_size','20'),(4,'days_purge','60'),(5,'days_compact','15'),(6,'graph_res','5'),(7,'step_compact','1'),(8,'db_scheme_version','2.0'),(9,'db_scheme_build','PD80401'),(13,'show_unknown','0'),(14,'show_lastalerts','1'),(15,'style','pandora', 16, 'remote_config', '/var/spool/pandora/data_in'); +(1,'language_code','en'),(3,'block_size','20'),(4,'days_purge','60'),(5,'days_compact','15'),(6,'graph_res','5'),(7,'step_compact','1'),(8,'db_scheme_version','2.0'),(9,'db_scheme_build','PD80401'),(13,'show_unknown','0'),(14,'show_lastalerts','1'),(15,'style','pandora'),(16, 'remote_config', '/var/spool/pandora/data_in'); UNLOCK TABLES; /*!40000 ALTER TABLE `tconfig` ENABLE KEYS */;