Feature: add warnings when history days is more less than purge days
(cherry picked from commit cc10f01c10
)
This commit is contained in:
parent
39d0486f06
commit
6fc0ff8a72
|
@ -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);
|
||||
|
||||
|
|
|
@ -640,6 +640,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')))
|
||||
|
@ -652,6 +654,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')))
|
||||
|
@ -1037,6 +1041,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', '');
|
||||
}
|
||||
|
@ -1061,6 +1069,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);
|
||||
}
|
||||
|
|
|
@ -662,12 +662,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'");
|
||||
|
@ -1000,6 +1002,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
|
||||
|
|
Loading…
Reference in New Issue