2008-06-09 Ramon Novoa <rnovoa@artica.es>
* 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. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@844 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c364df7b1d
commit
4d702fdf7f
|
@ -1,3 +1,13 @@
|
|||
2008-06-09 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* 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 <slerena@artica.es>
|
||||
|
||||
* pandoradb.sql: Updated tevent structure. Added criticity and
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
// Pandora FMS - the Free Monitoring System
|
||||
// ========================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
|
||||
// Copyright (c) 2008 Ramon Novoa <rnovoa@artica.es>
|
||||
// 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 '<form name="update" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">';
|
||||
echo '<table width="650" cellpadding="4" cellspacing="4" class="databox_color">';
|
||||
echo '<tr>';
|
||||
echo '<td class="datos"><b>' . $lang_label["agent_name"] . '</b></td>';
|
||||
echo '<td class="datos">';
|
||||
echo '<input disabled type="text" name="agente" size=30 value="' . $nombre_agente . '">';
|
||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="' . $id_agente . '">';
|
||||
echo '<img src="images/lupa.png" border="0" align="middle" alt="">';
|
||||
echo '</a>';
|
||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=' . $id_agente . '">';
|
||||
echo '<img src="images/cog.png" border="0" align="middle" alt="">';
|
||||
echo '</a>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td class="datos2" colspan="2">';
|
||||
echo '<textarea class="conf_editor" name="disk_conf">';
|
||||
echo entrada_limpia($agent_config);
|
||||
echo '</textarea>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '<table width="650"><tr><td align="right">';
|
||||
echo '<tr>';
|
||||
echo '<td align="right">';
|
||||
echo '<input name="updbutton" type="submit" class="sub upd" value="'.$lang_label["update"].'">';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
// 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 "<h3 class='suc'>" . $lang_label["update_agent_ok"] . "</h3>";
|
||||
}
|
||||
|
||||
display_config ();
|
||||
|
||||
// Footer
|
||||
echo "</div><div id='foot'>";
|
||||
include ("general/footer.php");
|
||||
echo "</div>";
|
||||
|
||||
?>
|
|
@ -40,6 +40,13 @@ if (isset($_GET["create_agent"])){
|
|||
echo "</h2>";
|
||||
echo "<div style='height: 5px'> </div>";
|
||||
|
||||
// Agent remote configuration editor
|
||||
$agent_md5 = md5($nombre_agente, FALSE);
|
||||
if (isset($_GET["disk_conf"])){
|
||||
require ("agent_disk_conf_editor.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente">';
|
||||
if ($create_agent == 1) {
|
||||
|
@ -60,6 +67,12 @@ if ((isset($id_agente)) && ($id_agente != "")){
|
|||
sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'>
|
||||
<img src='images/lupa.png' border='0' align='middle' alt=''></a>";
|
||||
}
|
||||
// Remote configuration available
|
||||
if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) {
|
||||
echo "
|
||||
<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$id_agente."&disk_conf=" . $agent_md5 . "'>
|
||||
<img src='images/application_edit.png' border='0' align='middle' alt=''></a>";
|
||||
}
|
||||
|
||||
echo '<tr><td class="datos2">';
|
||||
echo '<b>'.$lang_label["ip_address"].'</b>';
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */;
|
||||
|
||||
|
|
Loading…
Reference in New Issue