diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 771e00d11c..7e90a25639 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -24,7 +24,7 @@ if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_us return; } // Load enterprise extensions -enterprise_include_once ('godmode/setup/setup.php'); +//~ enterprise_include_once ('godmode/setup/setup.php'); /* NOTICE FOR DEVELOPERS: @@ -44,6 +44,8 @@ $table->style[0] = "font-weight: bold"; $table->size[0] = '70%'; $table->size[1] = '30%'; +enterprise_hook('enterprise_warnings_history_days'); + $table->data[1][0] = __('Max. days before delete events') . ui_print_help_tip(__('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), true); $table->data[1][1] = html_print_input_text ('event_purge', $config["event_purge"], '', 5, 5, true); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index cf69049c89..a17de825b1 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -648,6 +648,8 @@ function config_update_config () { case 'hist_db': if (!config_update_value ('history_db_enabled', get_parameter ('history_db_enabled'))) $error_update[] = __('Enable history database'); + if (!config_update_value ('history_event_enabled', get_parameter ('history_event_enabled'))) + $error_update[] = __('Enable history event'); if (!config_update_value ('history_db_host', get_parameter ('history_db_host'))) $error_update[] = __('Host'); if (!config_update_value ('history_db_port', get_parameter ('history_db_port'))) @@ -660,6 +662,8 @@ function config_update_config () { $error_update[] = __('Database password'); if (!config_update_value ('history_db_days', get_parameter ('history_db_days'))) $error_update[] = __('Days'); + if (!config_update_value ('history_event_days', get_parameter ('history_event_days'))) + $error_update[] = __('Event Days'); if (!config_update_value ('history_db_step', get_parameter ('history_db_step'))) $error_update[] = __('Step'); if (!config_update_value ('history_db_delay', get_parameter ('history_db_delay'))) @@ -1062,6 +1066,10 @@ function config_process_config () { config_update_value ( 'history_db_enabled', false); } + if (!isset ($config['history_event_enabled'])) { + config_update_value ( 'history_event_enabled', false); + } + if (!isset ($config['history_db_host'])) { config_update_value ( 'history_db_host', ''); } @@ -1086,6 +1094,10 @@ function config_process_config () { config_update_value ( 'history_db_days', 0); } + if (!isset ($config['history_event_days'])) { + config_update_value ('history_event_days', 90); + } + if (!isset ($config['history_db_step'])) { config_update_value ( 'history_db_step', 0); } diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index b5aea56ef3..ace7826b8a 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -689,12 +689,14 @@ sub pandora_load_config ($) { $conf->{'_last_compact'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'last_compact'"); $conf->{'_step_compact'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'step_compact'"); $conf->{'_history_db_enabled'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_enabled'"); + $conf->{'_history_event_enabled'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_event_enabled'"); $conf->{'_history_db_host'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_host'"); $conf->{'_history_db_port'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_port'"); $conf->{'_history_db_name'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_name'"); $conf->{'_history_db_user'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_user'"); $conf->{'_history_db_pass'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_pass'"); $conf->{'_history_db_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_days'"); + $conf->{'_history_event_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_event_days'"); $conf->{'_history_db_step'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_step'"); $conf->{'_history_db_delay'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_delay'"); $conf->{'_days_delete_unknown'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_delete_unknown'"); @@ -1038,6 +1040,10 @@ sub pandoradb_main ($$$) { # Move old data to the history DB if (defined ($history_dbh)) { undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); + if (defined($conf{'_history_event_enabled'})) { + log_message ('', "Entrando a los eventoss :::: " . $conf->{'_history_event_days'} . "\n"); + undef ($history_dbh) unless defined (enterprise_hook ('pandora_history_event', [$dbh, $history_dbh, $conf->{'_history_event_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); + } } # Compact on if enable and DaysCompact are below DaysPurge