2014-05-27 Alejandro Gallardo <alejandro.gallardo@artica.es>
* extensions/files_repo.php: Fixed a weird error when uploading big files. * godmode/setup/setup_general.php, include/functions_config.php: Now is possible to set a custom path to the pandora server logs. * extensions/pandora_logs.php, extensions/system_info.php: Now the custom server log path is used if exists. * include/functions.php: Now the function "get_file_upload_status" returns -1 when the $_FILES array is empty. * include/config_process.php: Fixed an error that could avoid the log in pandora_console.log. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10023 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e6c1085660
commit
d99fee01ce
|
@ -1,3 +1,22 @@
|
|||
2014-05-27 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
||||
|
||||
* extensions/files_repo.php: Fixed a weird error when
|
||||
uploading big files.
|
||||
|
||||
* godmode/setup/setup_general.php,
|
||||
include/functions_config.php: Now is possible to set
|
||||
a custom path to the pandora server logs.
|
||||
|
||||
* extensions/pandora_logs.php,
|
||||
extensions/system_info.php: Now the custom server log path
|
||||
is used if exists.
|
||||
|
||||
* include/functions.php: Now the function "get_file_upload_status"
|
||||
returns -1 when the $_FILES array is empty.
|
||||
|
||||
* include/config_process.php: Fixed an error that could
|
||||
avoid the log in pandora_console.log.
|
||||
|
||||
2014-05-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/reporting/graph_builder.main.php,
|
||||
|
|
|
@ -123,12 +123,18 @@ function pandora_files_repo_godmode () {
|
|||
return;
|
||||
}
|
||||
|
||||
// Check for an anoying error that causes the $_POST and $_FILES arrays
|
||||
// were empty if the file is larger than the post_max_size
|
||||
if (intval($_SERVER['CONTENT_LENGTH']) > 0 && empty($_POST)) {
|
||||
ui_print_error_message(__('The file exceeds the maximum size'));
|
||||
}
|
||||
|
||||
// GET and POST parameters
|
||||
$file_id = (int) get_parameter ("file_id");
|
||||
$add_file = (bool) get_parameter ("add_file");
|
||||
$update_file = (bool) get_parameter ("update_file");
|
||||
$delete_file = (bool) get_parameter ("delete");
|
||||
|
||||
|
||||
// File add or update
|
||||
if ( $add_file || ($update_file && $file_id > 0) ) {
|
||||
$groups = get_parameter ("groups", array());
|
||||
|
|
|
@ -73,12 +73,14 @@ function pandoralogs_extension_main () {
|
|||
|
||||
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
|
||||
|
||||
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
|
||||
|
||||
view_logfile ($config["homedir"]."/pandora_console.log");
|
||||
view_logfile ("/var/log/pandora/pandora_server.log");
|
||||
view_logfile ("/var/log/pandora/pandora_server.error");
|
||||
view_logfile ($logs_directory."/pandora_server.log");
|
||||
view_logfile ($logs_directory."/pandora_server.error");
|
||||
}
|
||||
|
||||
extensions_add_godmode_menu_option (__('System logfiles'), 'PM','glog', null, "v1r1");
|
||||
extensions_add_godmode_function('pandoralogs_extension_main');
|
||||
|
||||
?>
|
||||
?>
|
|
@ -76,6 +76,8 @@ function getPandoraDiagnostic(&$systemInfo) {
|
|||
}
|
||||
|
||||
function getSystemInfo(&$systemInfo, $script = false) {
|
||||
global $config;
|
||||
|
||||
$systemInfo['system_name'] = php_uname('s');
|
||||
$systemInfo['system_host'] = php_uname('n');
|
||||
$systemInfo['system_release'] = php_uname('r');
|
||||
|
@ -127,8 +129,10 @@ function getSystemInfo(&$systemInfo, $script = false) {
|
|||
}
|
||||
}
|
||||
$systemInfo['process'] = $process;
|
||||
|
||||
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
|
||||
|
||||
$result = shell_exec('du -h /var/log/pandora | cut -d"/" -f1');
|
||||
$result = shell_exec('du -h ' . $logs_directory . ' | cut -d"/" -f1');
|
||||
$systemInfo['size_var_log_pandora'] = $result;
|
||||
|
||||
$result = shell_exec('date');
|
||||
|
@ -180,10 +184,12 @@ function logFilesLines($file_name, $numLines) {
|
|||
|
||||
function getLastLog($numLines = 2000) {
|
||||
global $config;
|
||||
|
||||
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
|
||||
|
||||
show_logfile($config["homedir"]."/pandora_console.log", $numLines);
|
||||
show_logfile("/var/log/pandora/pandora_server.log", $numLines);
|
||||
show_logfile("/var/log/pandora/pandora_server.error", $numLines);
|
||||
show_logfile($logs_directory."/pandora_server.log", $numLines);
|
||||
show_logfile($logs_directory."/pandora_server.error", $numLines);
|
||||
show_logfile("/etc/mysql/my.cnf", $numLines);
|
||||
show_logfile($config["homedir"]."/include/config.php", $numLines);
|
||||
show_logfile("/etc/pandora/pandora_server.conf", $numLines);
|
||||
|
@ -386,13 +392,15 @@ function mainSystemInfo() {
|
|||
|
||||
$zip->addFile($tempDir . 'system_info.txt', 'system_info.txt');
|
||||
}
|
||||
|
||||
$server_logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
|
||||
|
||||
if ($log_info) {
|
||||
file_put_contents($tempDir . 'pandora_console.log.lines_' . $log_num_lines, getLastLinesLog($config["homedir"]."/pandora_console.log", $log_num_lines));
|
||||
$zip->addFile($tempDir . 'pandora_console.log.lines_' . $log_num_lines, 'pandora_console.log.lines_' . $log_num_lines);
|
||||
file_put_contents($tempDir . 'pandora_server.log.lines_' . $log_num_lines, getLastLinesLog("/var/log/pandora/pandora_server.log", $log_num_lines));
|
||||
file_put_contents($tempDir . 'pandora_server.log.lines_' . $log_num_lines, getLastLinesLog($server_logs_directory."/pandora_server.log", $log_num_lines));
|
||||
$zip->addFile($tempDir . 'pandora_server.log.lines_' . $log_num_lines, 'pandora_server.log.lines_' . $log_num_lines);
|
||||
file_put_contents($tempDir . 'pandora_server.error.lines_' . $log_num_lines, getLastLinesLog("/var/log/pandora/pandora_server.error", $log_num_lines));
|
||||
file_put_contents($tempDir . 'pandora_server.error.lines_' . $log_num_lines, getLastLinesLog($server_logs_directory."/pandora_server.error", $log_num_lines));
|
||||
$zip->addFile($tempDir . 'pandora_server.error.lines_' . $log_num_lines, 'pandora_server.error.lines_' . $log_num_lines);
|
||||
file_put_contents($tempDir . 'my.cnf.lines_' . $log_num_lines, getLastLinesLog("/etc/mysql/my.cnf", $log_num_lines));
|
||||
$zip->addFile($tempDir . 'my.cnf.lines_' . $log_num_lines, 'my.cnf.lines_' . $log_num_lines);
|
||||
|
@ -519,6 +527,8 @@ function consoleMode() {
|
|||
|
||||
if ($pandoraConfFiles) {
|
||||
$lines = 2000;
|
||||
|
||||
$system_logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
|
||||
|
||||
$file = fopen($tempDir . 'pandora_console.log' . $lines, 'w');
|
||||
if ($file !== false) {
|
||||
|
@ -532,7 +542,7 @@ function consoleMode() {
|
|||
$file = fopen($tempDir . 'pandora_server.log' . $lines, 'w');
|
||||
if ($file !== false) {
|
||||
ob_start();
|
||||
echo getLastLinesLog("/var/log/pandora/pandora_server.log", $lines);
|
||||
echo getLastLinesLog($system_logs_directory."/pandora_server.log", $lines);
|
||||
$output = ob_get_clean();
|
||||
fwrite($file, $output);
|
||||
fclose($file);
|
||||
|
@ -541,7 +551,7 @@ function consoleMode() {
|
|||
$file = fopen($tempDir . 'pandora_server.error' . $lines, 'w');
|
||||
if ($file !== false) {
|
||||
ob_start();
|
||||
echo getLastLinesLog("/var/log/pandora/pandora_server.error", $lines);
|
||||
echo getLastLinesLog($system_logs_directory."/pandora_server.error", $lines);
|
||||
$output = ob_get_clean();
|
||||
fwrite($file, $output);
|
||||
fclose($file);
|
||||
|
@ -586,7 +596,7 @@ function consoleMode() {
|
|||
$file = fopen($tempDir . 'pandora_server.error' . $lines, 'w');
|
||||
if ($file !== false) {
|
||||
ob_start();
|
||||
echo getLastLinesLog("/var/log/pandora/pandora_server.error", $lines);
|
||||
echo getLastLinesLog($system_logs_directory."/pandora_server.error", $lines);
|
||||
$output = ob_get_clean();
|
||||
fwrite($file, $output);
|
||||
fclose($file);
|
||||
|
@ -595,7 +605,7 @@ function consoleMode() {
|
|||
$file = fopen($tempDir . 'pandora_server.log' . $lines, 'w');
|
||||
if ($file !== false) {
|
||||
ob_start();
|
||||
echo getLastLinesLog("/var/log/pandora/pandora_server.log", $lines);
|
||||
echo getLastLinesLog($system_logs_directory."/pandora_server.log", $lines);
|
||||
$output = ob_get_clean();
|
||||
fwrite($file, $output);
|
||||
fclose($file);
|
||||
|
|
|
@ -244,6 +244,9 @@ $table->data[31][0] = __('Command Snapshot') .
|
|||
$table->data[31][1] = __('Yes').' '.html_print_radio_button ('command_snapshot', 1, '', $config["command_snapshot"], true).' ';
|
||||
$table->data[31][1] .= __('No').' '.html_print_radio_button ('command_snapshot', 0, '', $config["command_snapshot"], true);
|
||||
|
||||
$table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Directory where the server logs are stored."), true);
|
||||
$table->data[32][1] = html_print_input_text ('server_log_dir', $config["server_log_dir"], '', 50, 255, true);
|
||||
|
||||
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
echo "<fieldset>";
|
||||
|
|
|
@ -50,6 +50,7 @@ if ($develop_bypass != 1) {
|
|||
}
|
||||
|
||||
ini_set("display_errors", 0);
|
||||
ini_set("log_errors", 1);
|
||||
ini_set("error_log", $config["homedir"]."/pandora_console.log");
|
||||
}
|
||||
else {
|
||||
|
@ -63,6 +64,7 @@ else {
|
|||
error_reporting(E_ALL);
|
||||
}
|
||||
ini_set("display_errors", 1);
|
||||
ini_set("log_errors", 1);
|
||||
ini_set("error_log", $config["homedir"]."/pandora_console.log");
|
||||
}
|
||||
|
||||
|
|
|
@ -1973,6 +1973,9 @@ function can_user_access_node () {
|
|||
* Get the upload status code
|
||||
*/
|
||||
function get_file_upload_status ($file_input_name) {
|
||||
if (!isset($_FILES[$file_input_name]))
|
||||
return -1;
|
||||
|
||||
return $_FILES[$file_input_name]['error'];
|
||||
}
|
||||
|
||||
|
|
|
@ -179,6 +179,8 @@ function config_update_config () {
|
|||
$error_update[] = __('Event storm protection');
|
||||
if (!config_update_value ('command_snapshot', get_parameter('command_snapshot')))
|
||||
$error_update[] = __('Command Snapshot');
|
||||
if (!config_update_value ('server_log_dir', get_parameter('server_log_dir')))
|
||||
$error_update[] = __('Server logs directory');
|
||||
break;
|
||||
case 'enterprise':
|
||||
if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) {
|
||||
|
|
Loading…
Reference in New Issue