diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9723654a23..08cd90a4e6 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2008-09-18 Ramon Novoa + + * 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 * install.php: Fixed a bad description string. diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index dca9fc3f3c..0fe004b9e0 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -193,7 +193,13 @@ if (give_acl ($config['id_user'], 0, "PM")) { echo ""; } - + if ($sec == "gservers") { + if ($sec2 == "godmode/servers/manage_export"|| $sec2 == "godmode/servers/manage_export_form") { + echo "
"; + } else + echo ""; + } // AUDIT // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ($sec2 == "godmode/admin_access_logs") { diff --git a/pandora_console/godmode/servers/manage_export.php b/pandora_console/godmode/servers/manage_export.php new file mode 100644 index 0000000000..10d4ad5774 --- /dev/null +++ b/pandora_console/godmode/servers/manage_export.php @@ -0,0 +1,132 @@ +'.__('Error updating export target').''; + } else { + echo '

'.__('Successfully updated export target').'

'; + } +} + +// Delete +if ($delete) { + $sql = sprintf("DELETE FROM tserver_export WHERE id = '%d'", $delete); + if (process_sql ($sql) === false) { + echo '

'.__('Error deleting export server').'

'; + } else { + echo '

'.__('Succesfully deleted export server').'

'; + } +} + +// 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 '

'.__('Error creating recon task').'

'; + } else { + echo '

'.__('Successfully created recon task').'

'; + } +} + +// List export servers +echo "

".__('Pandora servers')." > ".__('Manage export targets')."

"; + +$result = get_db_all_rows_in_table ("tserver_export"); +if (!$result) { + echo '
'.__('There are no export targets configured').'
'; + echo '
'; + echo '
'; + echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true); + echo '
'; + echo '
'; + 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 + '' . $row['name'] . '', + $row['preffix'], + $row['interval'], + $row['ip_server'], + $row['connect_mode'], + // Action + ' +    + ' + ); +} + +print_table ($table); + +echo '
'; +echo '
'; +echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true); +echo '
'; +echo '
'; + +?> diff --git a/pandora_console/godmode/servers/manage_export_form.php b/pandora_console/godmode/servers/manage_export_form.php new file mode 100644 index 0000000000..e46d0c25e1 --- /dev/null +++ b/pandora_console/godmode/servers/manage_export_form.php @@ -0,0 +1,135 @@ +'.__('Pandora servers').' > '.__('Manage export servers'); +//pandora_help ("exportserver"); +echo ''; + +$table->width=700; +$table->cellspacing=4; +$table->class="databox_color"; + +echo '
'; + + +// 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 '
'; +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 ''; +echo "
"; + + +echo ""; + +?> diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 21ccaec5e6..a42d73adf5 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -26,7 +26,7 @@ if (!isset ($pandora_version)) // 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 -$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) $config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf"; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 64238bc489..fec61f8430 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -808,7 +808,7 @@ function borrar_incidencia ($id_inc) { if ($rows){ foreach ($rows as $row) { // 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); process_sql ($sql); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 48906c79db..792da92b8c 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -689,6 +689,9 @@ CREATE TABLE IF NOT EXISTS `tserver_export` ( `id_export_server` int(10) unsigned default NULL, `user` 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`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -698,9 +701,11 @@ CREATE TABLE IF NOT EXISTS `tserver_export` ( CREATE TABLE IF NOT EXISTS `tserver_export_data` ( `id` int(20) unsigned NOT NULL auto_increment, `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, - `utimestamp` int(10) unsigned default '0', + `timestamp` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;