diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index d19d3587c6..91bab6902b 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -595,6 +595,14 @@ $table->data[$i++][1] = html_print_checkbox_switch( true ); +$table->data[$i][0] = __('Check conexion interval'); +$table->data[$i++][1] = html_print_input_number( + [ + 'name' => 'check_conexion_interval', + 'min' => 90, + 'value' => $config['check_conexion_interval'], + ] +); echo '
'; echo '
'; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 24d2de537d..0c564e0458 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -368,6 +368,10 @@ function config_update_config() $error_update[] = __('Enable console report'); } + if (config_update_value('check_conexion_interval', get_parameter('check_conexion_interval'), true) === false) { + $error_update[] = __('Check conexion interval'); + } + if (config_update_value('unique_ip', get_parameter('unique_ip'), true) === false) { $error_update[] = __('Unique IP'); } @@ -2281,6 +2285,10 @@ function config_process_config() config_update_value('reporting_console_enable', 0); } + if (!isset($config['check_conexion_interval'])) { + config_update_value('check_conexion_interval', 180); + } + if (!isset($config['elasticsearch_ip'])) { config_update_value('elasticsearch_ip', ''); } diff --git a/pandora_console/include/javascript/connection_check.js b/pandora_console/include/javascript/connection_check.js index 66027b6de0..f791a36232 100644 --- a/pandora_console/include/javascript/connection_check.js +++ b/pandora_console/include/javascript/connection_check.js @@ -4,16 +4,17 @@ * Connection Check * -------------------------------------- */ - -checkConnection(1); +$(document).ready(function() { + checkConnection(get_php_value("check_conexion_interval")); +}); /** * Performs connection tests every minutes and add connection listeners * @param {integer} time in minutes */ -function checkConnection(minutes) { - var cicle = minutes * 60 * 1000; +function checkConnection(seconds) { + var cicle = seconds * 1000; var checkConnection = setInterval(handleConnection, cicle); // Connection listeters. @@ -48,7 +49,7 @@ function handleConnection() { // If test connection file is not found, do not show message. if (err.status != 404) { connected = false; - msg = err; + msg = err.statusText; } else { connected = true; } diff --git a/pandora_console/index.php b/pandora_console/index.php index a2c9d62167..9751c46043 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1487,6 +1487,7 @@ echo html_print_div( ); // Connection lost alert. +set_js_value('check_conexion_interval', $config['check_conexion_interval']); ui_require_javascript_file('connection_check'); set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false)); $conn_title = __('Connection with server has been lost');