mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
2008-09-18 Ramon Novoa <rnovoa@artica.es>
* include/config_process.php, include/functions_db.php: Small fixes. * godmode/servers/manage_export.php, godmode/servers/manage_export_form.php: Added to repository. Export target configuration. * godmode/menu.php, pandoradb.sql: Added support for export target configuration. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1100 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
35748efd98
commit
a8c79a0cd0
@ -1,3 +1,13 @@
|
|||||||
|
2008-09-18 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* include/config_process.php,
|
||||||
|
include/functions_db.php: Small fixes.
|
||||||
|
* godmode/servers/manage_export.php,
|
||||||
|
godmode/servers/manage_export_form.php: Added to repository. Export
|
||||||
|
target configuration.
|
||||||
|
* godmode/menu.php,
|
||||||
|
pandoradb.sql: Added support for export target configuration.
|
||||||
|
|
||||||
2008-09-18 Sancho Lerena <slerena@artica.es>
|
2008-09-18 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* install.php: Fixed a bad description string.
|
* install.php: Fixed a bad description string.
|
||||||
|
@ -193,7 +193,13 @@ if (give_acl ($config['id_user'], 0, "PM")) {
|
|||||||
|
|
||||||
echo "<ul class='mn'><li><a href='index.php?sec=gservers&sec2=godmode/servers/plugin' class='mn'>".__('Manage plugins')."</a></li></ul></div>";
|
echo "<ul class='mn'><li><a href='index.php?sec=gservers&sec2=godmode/servers/plugin' class='mn'>".__('Manage plugins')."</a></li></ul></div>";
|
||||||
}
|
}
|
||||||
|
if ($sec == "gservers") {
|
||||||
|
if ($sec2 == "godmode/servers/manage_export"|| $sec2 == "godmode/servers/manage_export_form") {
|
||||||
|
echo "<div class='arrowgs'>";
|
||||||
|
} else
|
||||||
|
echo "<div class='arrowg'>";
|
||||||
|
echo "<ul class='mn'><li><a href='index.php?sec=gservers&sec2=godmode/servers/manage_export' class='mn'>".__('Export targets')."</a></li></ul></div>";
|
||||||
|
}
|
||||||
// AUDIT
|
// AUDIT
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
if ($sec2 == "godmode/admin_access_logs") {
|
if ($sec2 == "godmode/admin_access_logs") {
|
||||||
|
132
pandora_console/godmode/servers/manage_export.php
Normal file
132
pandora_console/godmode/servers/manage_export.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Pandora FMS - the Flexible Monitoring System
|
||||||
|
// ============================================
|
||||||
|
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.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.
|
||||||
|
|
||||||
|
|
||||||
|
// Load global vars
|
||||||
|
require ("include/config.php");
|
||||||
|
|
||||||
|
check_login ();
|
||||||
|
|
||||||
|
if (! give_acl ($config['id_user'], 0, "LM")) {
|
||||||
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||||
|
"Trying to access Export Server Management");
|
||||||
|
require ("general/noaccess.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = (string) get_parameter ("name");
|
||||||
|
$export_server = (int) get_parameter ("export_server");
|
||||||
|
$preffix = (string) get_parameter ("preffix");
|
||||||
|
$interval = (int) get_parameter ("interval");
|
||||||
|
$ip_server = (string) get_parameter ("ip_server");
|
||||||
|
$connect_mode = (string) get_parameter ("connect_mode");
|
||||||
|
$user = (string) get_parameter ("user");
|
||||||
|
$password = (string) get_parameter ("password");
|
||||||
|
$port = (string) get_parameter ("port");
|
||||||
|
$directory = (string) get_parameter ("directory");
|
||||||
|
$options = (string) get_parameter ("options");
|
||||||
|
$create = (int) get_parameter ("create");
|
||||||
|
$delete = (int) get_parameter ("delete");
|
||||||
|
$update = (int) get_parameter ("update");
|
||||||
|
|
||||||
|
// Update
|
||||||
|
if ($update) {
|
||||||
|
$sql = sprintf ("UPDATE tserver_export SET name = '%s', id_export_server = %d,
|
||||||
|
preffix = '%s', `interval` = %d, ip_server = '%s', connect_mode = '%s',
|
||||||
|
user = '%s', pass = '%s', port = %d, directory = '%s', options = '%s'
|
||||||
|
WHERE id = %d",
|
||||||
|
$name, $export_server, $preffix, $interval, $ip_server, $connect_mode,
|
||||||
|
$user, $password, $port, $directory, $options, $update);
|
||||||
|
if (process_sql ($sql) === false) {
|
||||||
|
echo '<h3 class="error">'.__('Error updating export target').'</h3>';
|
||||||
|
} else {
|
||||||
|
echo '<h3 class="suc">'.__('Successfully updated export target').'</h3>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete
|
||||||
|
if ($delete) {
|
||||||
|
$sql = sprintf("DELETE FROM tserver_export WHERE id = '%d'", $delete);
|
||||||
|
if (process_sql ($sql) === false) {
|
||||||
|
echo '<h3 class="error">'.__('Error deleting export server').'</h3>';
|
||||||
|
} else {
|
||||||
|
echo '<h3 class="suc">'.__('Succesfully deleted export server').'</h3>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create
|
||||||
|
if ($create) {
|
||||||
|
$sql = sprintf ("INSERT INTO tserver_export
|
||||||
|
(`name`, `id_export_server`, `preffix`, `interval`, `ip_server`, `connect_mode`,
|
||||||
|
`user`, `pass`, `port`, `directory`, `options`)
|
||||||
|
VALUES ('%s', %d, '%s', %d, '%s', '%s', '%s', '%s', %d, '%s', '%s')",
|
||||||
|
$name, $export_server, $preffix, $interval, $ip_server, $connect_mode,
|
||||||
|
$user, $password, $port, $directory, $options);
|
||||||
|
|
||||||
|
if (process_sql ($sql) === false) {
|
||||||
|
echo '<h3 class="error">'.__('Error creating recon task').'</h3>';
|
||||||
|
} else {
|
||||||
|
echo '<h3 class="suc">'.__('Successfully created recon task').'</h3>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List export servers
|
||||||
|
echo "<h2>".__('Pandora servers')." > ".__('Manage export targets')."</h2>";
|
||||||
|
|
||||||
|
$result = get_db_all_rows_in_table ("tserver_export");
|
||||||
|
if (!$result) {
|
||||||
|
echo '<div class="nf">'.__('There are no export targets configured').'</div>';
|
||||||
|
echo '<div class="action-buttons" style="width: 700px">';
|
||||||
|
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&create">';
|
||||||
|
echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
|
||||||
|
echo '</form>';
|
||||||
|
echo '</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->head = array (__('Name'), __('Preffix'), __('Interval'), __('Address'), __('Transfer Mode'), __('Action'));
|
||||||
|
//$table->align = array ("","","","center","","","center","center");
|
||||||
|
$table->width = 700;
|
||||||
|
$table->cellpadding = 4;
|
||||||
|
$table->cellspacing = 4;
|
||||||
|
$table->class = "databox";
|
||||||
|
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$table->data[] = array (
|
||||||
|
// Name
|
||||||
|
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&update=' . $row['id'] . '"><b>' . $row['name'] . '</b></a>',
|
||||||
|
$row['preffix'],
|
||||||
|
$row['interval'],
|
||||||
|
$row['ip_server'],
|
||||||
|
$row['connect_mode'],
|
||||||
|
// Action
|
||||||
|
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export&delete=' . $row['id'] . '">
|
||||||
|
<img src="images/cross.png" border="0" /></a> <a href="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&update=' . $row['id'] . '">
|
||||||
|
<img src="images/config.png" /></a>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
print_table ($table);
|
||||||
|
|
||||||
|
echo '<div class="action-buttons" style="width: 700px">';
|
||||||
|
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&create">';
|
||||||
|
echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
|
||||||
|
echo '</form>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
?>
|
135
pandora_console/godmode/servers/manage_export_form.php
Normal file
135
pandora_console/godmode/servers/manage_export_form.php
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Pandora FMS - the Flexible Monitoring System
|
||||||
|
// ============================================
|
||||||
|
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.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.
|
||||||
|
|
||||||
|
// Load global vars
|
||||||
|
require ("include/config.php");
|
||||||
|
|
||||||
|
check_login ();
|
||||||
|
|
||||||
|
if (! give_acl ($config['id_user'], 0, "PM")) {
|
||||||
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||||
|
"Trying to access Agent Management");
|
||||||
|
require ("general/noaccess.php");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = (int) get_parameter ("update");
|
||||||
|
|
||||||
|
if ($update) {
|
||||||
|
$row = get_db_row ("tserver_export", "id", $update);
|
||||||
|
$name = $row["name"];
|
||||||
|
$export_server = $row["id_export_server"];
|
||||||
|
$preffix = $row["preffix"];
|
||||||
|
$interval = $row["interval"];
|
||||||
|
$ip_server = $row["ip_server"];
|
||||||
|
$connect_mode = $row["connect_mode"];
|
||||||
|
$user = $row["user"];
|
||||||
|
$password = $row["pass"];
|
||||||
|
$port = $row["port"];
|
||||||
|
$directory = $row["directory"];
|
||||||
|
$options = $row["options"];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$name = '';
|
||||||
|
$export_server = 0;
|
||||||
|
$preffix = '';
|
||||||
|
$interval = 300;
|
||||||
|
$ip_server = '';
|
||||||
|
$connect_mode = 'ssh';
|
||||||
|
$user = 'pandora';
|
||||||
|
$password = '';
|
||||||
|
$port = 22;
|
||||||
|
$directory = '/var/spool/pandora/data_in';
|
||||||
|
$options = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<h2>'.__('Pandora servers').' > '.__('Manage export servers');
|
||||||
|
//pandora_help ("exportserver");
|
||||||
|
echo '</h2>';
|
||||||
|
|
||||||
|
$table->width=700;
|
||||||
|
$table->cellspacing=4;
|
||||||
|
$table->class="databox_color";
|
||||||
|
|
||||||
|
echo '<form name="modulo" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/manage_export&' . ($update ? "update=$update" : 'create=1') . '">';
|
||||||
|
|
||||||
|
|
||||||
|
// Name
|
||||||
|
$table->data[0][0] = __('Name');
|
||||||
|
$table->data[0][1] = print_input_text ('name', $name, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Export server
|
||||||
|
$table->data[1][0] = __('Export server');
|
||||||
|
$table->data[1][1] = print_select_from_sql ('SELECT id_server, name FROM tserver WHERE export_server = 1 ORDER BY name',
|
||||||
|
'export_server', $export_server, '', __('None'), 0, true);
|
||||||
|
|
||||||
|
// Preffix
|
||||||
|
$table->data[2][0] = __('Preffix');
|
||||||
|
$table->data[2][1] = print_input_text ('preffix', $preffix, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Interval
|
||||||
|
$table->data[3][0] = __('Interval');
|
||||||
|
$table->data[3][1] = print_input_text ('interval', $interval, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Address
|
||||||
|
$table->data[4][0] = __('Address');
|
||||||
|
$table->data[4][1] = print_input_text ('ip_server', $ip_server, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Transfer mode
|
||||||
|
$table->data[5][0] = __('Transfer mode');
|
||||||
|
$transfer_mode_select = array (
|
||||||
|
'tentacle' => 'tentacle',
|
||||||
|
'ssh' => 'ssh',
|
||||||
|
'ftp' => 'ftp',
|
||||||
|
'local' => 'local');
|
||||||
|
$table->data[5][1] = print_select ($transfer_mode_select, "connect_mode", $connect_mode, '', '', '', true);
|
||||||
|
|
||||||
|
// User
|
||||||
|
$table->data[6][0] = __('User');
|
||||||
|
$table->data[6][1] = print_input_text ('user', $user, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$table->data[7][0] = __('Password');
|
||||||
|
$table->data[7][1] = print_input_password ('password', $password, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$table->data[8][0] = __('Port');
|
||||||
|
$table->data[8][1] = print_input_text ('port', $port, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Directory
|
||||||
|
$table->data[9][0] = __('Target directory');
|
||||||
|
$table->data[9][1] = print_input_text ('directory', $directory, '', 25, 0, true);
|
||||||
|
|
||||||
|
// Options
|
||||||
|
$table->data[10][0] = __('Extra options');
|
||||||
|
$table->data[10][1] = print_input_text ('options', $options, '', 25, 0, true);
|
||||||
|
|
||||||
|
print_table ($table);
|
||||||
|
|
||||||
|
echo '<div class="action-buttons" style="width: 700px">';
|
||||||
|
if ($update)
|
||||||
|
echo print_submit_button (__('Update'),"crt",false,'class="sub upd"',true);
|
||||||
|
else
|
||||||
|
echo print_submit_button (__('Add'),"crt",false,'class="sub wand"',true);
|
||||||
|
echo '</form>';
|
||||||
|
echo "</div>";
|
||||||
|
|
||||||
|
|
||||||
|
echo "</form>";
|
||||||
|
|
||||||
|
?>
|
@ -26,7 +26,7 @@ if (!isset ($pandora_version))
|
|||||||
// This MUST be writtable by http server user, and should be in pandora root.
|
// This MUST be writtable by http server user, and should be in pandora root.
|
||||||
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
|
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
|
||||||
|
|
||||||
$config["attachment_store"] = $config["homedir"]."attachment";
|
$config["attachment_store"] = $config["homedir"]."/attachment";
|
||||||
|
|
||||||
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
|
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
|
||||||
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
|
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
|
||||||
|
@ -808,7 +808,7 @@ function borrar_incidencia ($id_inc) {
|
|||||||
if ($rows){
|
if ($rows){
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
// Unlink all attached files for this incident
|
// Unlink all attached files for this incident
|
||||||
unlink ($attachment_store."attachment/pand".$row["id_attachment"]."_".$row["filename"]);
|
unlink ($attachment_store."/pand".$row["id_attachment"]."_".$row["filename"]);
|
||||||
}
|
}
|
||||||
$sql = sprintf ("DELETE FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
|
$sql = sprintf ("DELETE FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
|
||||||
process_sql ($sql);
|
process_sql ($sql);
|
||||||
|
@ -689,6 +689,9 @@ CREATE TABLE IF NOT EXISTS `tserver_export` (
|
|||||||
`id_export_server` int(10) unsigned default NULL,
|
`id_export_server` int(10) unsigned default NULL,
|
||||||
`user` varchar(100) NOT NULL default '',
|
`user` varchar(100) NOT NULL default '',
|
||||||
`pass` varchar(100) NOT NULL default '',
|
`pass` varchar(100) NOT NULL default '',
|
||||||
|
`port` int(4) unsigned default '0',
|
||||||
|
`directory` varchar(100) NOT NULL default '',
|
||||||
|
`options` varchar(100) NOT NULL default '',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
@ -698,9 +701,11 @@ CREATE TABLE IF NOT EXISTS `tserver_export` (
|
|||||||
CREATE TABLE IF NOT EXISTS `tserver_export_data` (
|
CREATE TABLE IF NOT EXISTS `tserver_export_data` (
|
||||||
`id` int(20) unsigned NOT NULL auto_increment,
|
`id` int(20) unsigned NOT NULL auto_increment,
|
||||||
`id_export_server` int(10) unsigned default NULL,
|
`id_export_server` int(10) unsigned default NULL,
|
||||||
`id_agent_module` mediumint(8) unsigned NOT NULL default '0',
|
`agent_name` varchar(100) NOT NULL default '',
|
||||||
|
`module_name` varchar(100) NOT NULL default '',
|
||||||
|
`module_type` varchar(100) NOT NULL default '',
|
||||||
`data` varchar(255) default NULL,
|
`data` varchar(255) default NULL,
|
||||||
`utimestamp` int(10) unsigned default '0',
|
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user