#10253 added console alert for control variables performance
This commit is contained in:
parent
31acafc00f
commit
aedf6986b3
|
@ -151,6 +151,8 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
|
|||
}
|
||||
}
|
||||
|
||||
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
|
||||
|
||||
$table_status = new StdClass();
|
||||
$table_status->width = '100%';
|
||||
$table_status->class = 'databox filters';
|
||||
|
@ -261,11 +263,11 @@ $table->data[1][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 45,
|
||||
'max' => $performance_variables_control['event_purge']->max,
|
||||
'name' => 'event_purge',
|
||||
'value' => $config['event_purge'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['event_purge']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -275,11 +277,11 @@ $table->data[2][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 45,
|
||||
'max' => $performance_variables_control['trap_purge']->max,
|
||||
'name' => 'trap_purge',
|
||||
'value' => $config['trap_purge'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['trap_purge']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -289,11 +291,11 @@ $table->data[3][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 365,
|
||||
'max' => $performance_variables_control['audit_purge']->max,
|
||||
'name' => 'audit_purge',
|
||||
'value' => $config['audit_purge'],
|
||||
'return' => true,
|
||||
'min' => 7,
|
||||
'min' => $performance_variables_control['audit_purge']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -303,11 +305,11 @@ $table->data[4][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 365,
|
||||
'max' => $performance_variables_control['string_purge']->max,
|
||||
'name' => 'string_purge',
|
||||
'value' => $config['string_purge'],
|
||||
'return' => true,
|
||||
'min' => 7,
|
||||
'min' => $performance_variables_control['string_purge']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -317,11 +319,11 @@ $table->data[5][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 365,
|
||||
'max' => $performance_variables_control['gis_purge']->max,
|
||||
'name' => 'gis_purge',
|
||||
'value' => $config['gis_purge'],
|
||||
'return' => true,
|
||||
'min' => 7,
|
||||
'min' => $performance_variables_control['gis_purge']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -331,11 +333,11 @@ $table->data[6][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 365,
|
||||
'max' => $performance_variables_control['days_purge']->max,
|
||||
'name' => 'days_purge',
|
||||
'value' => $config['days_purge'],
|
||||
'return' => true,
|
||||
'min' => 7,
|
||||
'min' => $performance_variables_control['days_purge']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -345,11 +347,11 @@ $table->data[7][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 365,
|
||||
'max' => $performance_variables_control['days_compact']->max,
|
||||
'name' => 'days_compact',
|
||||
'value' => $config['days_compact'],
|
||||
'return' => true,
|
||||
'min' => 0,
|
||||
'min' => $performance_variables_control['days_compact']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -359,11 +361,11 @@ $table->data[8][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 90,
|
||||
'max' => $performance_variables_control['days_delete_unknown']->max,
|
||||
'name' => 'days_delete_unknown',
|
||||
'value' => $config['days_delete_unknown'],
|
||||
'return' => true,
|
||||
'min' => 0,
|
||||
'min' => $performance_variables_control['days_delete_unknown']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -374,11 +376,11 @@ $table->data[9][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 90,
|
||||
'max' => $performance_variables_control['days_delete_not_initialized']->max,
|
||||
'name' => 'days_delete_not_initialized',
|
||||
'value' => $config['days_delete_not_initialized'],
|
||||
'return' => true,
|
||||
'min' => 0,
|
||||
'min' => $performance_variables_control['days_delete_not_initialized']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -388,11 +390,11 @@ $table->data[10][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 90,
|
||||
'max' => $performance_variables_control['days_autodisable_deletion']->max,
|
||||
'name' => 'days_autodisable_deletion',
|
||||
'value' => $config['days_autodisable_deletion'],
|
||||
'return' => true,
|
||||
'min' => 0,
|
||||
'min' => $performance_variables_control['days_autodisable_deletion']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -539,11 +541,11 @@ $table->data[] = [
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 30,
|
||||
'max' => $performance_variables_control['delete_old_network_matrix']->max,
|
||||
'name' => 'delete_old_network_matrix',
|
||||
'value' => $config['delete_old_network_matrix'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['delete_old_network_matrix']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
),
|
||||
|
@ -563,11 +565,11 @@ $table_other->data[$i++][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 500,
|
||||
'max' => $performance_variables_control['report_limit']->max,
|
||||
'name' => 'report_limit',
|
||||
'value' => $config['report_limit'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['report_limit']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -597,11 +599,11 @@ $table_other->data[$i++][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 360,
|
||||
'max' => $performance_variables_control['event_view_hr']->max,
|
||||
'name' => 'event_view_hr',
|
||||
'value' => $config['event_view_hr'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['event_view_hr']->min,
|
||||
'style' => 'width:43px',
|
||||
]
|
||||
);
|
||||
|
@ -645,11 +647,11 @@ $table_other->data[$i++][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 10000,
|
||||
'max' => $performance_variables_control['big_operation_step_datos_purge']->max,
|
||||
'name' => 'big_operation_step_datos_purge',
|
||||
'value' => $config['big_operation_step_datos_purge'],
|
||||
'return' => true,
|
||||
'min' => 100,
|
||||
'min' => $performance_variables_control['big_operation_step_datos_purge']->min,
|
||||
'style' => 'width:50px',
|
||||
]
|
||||
);
|
||||
|
@ -661,11 +663,11 @@ $table_other->data[$i++][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 10000,
|
||||
'max' => $performance_variables_control['small_operation_step_datos_purge']->max,
|
||||
'name' => 'small_operation_step_datos_purge',
|
||||
'value' => $config['small_operation_step_datos_purge'],
|
||||
'return' => true,
|
||||
'min' => 100,
|
||||
'min' => $performance_variables_control['small_operation_step_datos_purge']->min,
|
||||
'style' => 'width:50px',
|
||||
]
|
||||
);
|
||||
|
@ -695,11 +697,11 @@ $table_other->data[$i++][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 100000,
|
||||
'max' => $performance_variables_control['row_limit_csv']->max,
|
||||
'name' => 'row_limit_csv',
|
||||
'value' => $config['row_limit_csv'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['row_limit_csv']->min,
|
||||
'style' => 'width:63px',
|
||||
]
|
||||
);
|
||||
|
|
|
@ -47,6 +47,8 @@ if (is_ajax()) {
|
|||
exit();
|
||||
}
|
||||
|
||||
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
|
||||
|
||||
$table = new StdClass();
|
||||
$table->class = 'databox filters';
|
||||
$table->id = 'setup_general';
|
||||
|
@ -516,11 +518,11 @@ $table->data[$i++][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 2000,
|
||||
'max' => $performance_variables_control['limit_parameters_massive']->max,
|
||||
'name' => 'limit_parameters_massive',
|
||||
'value' => $config['limit_parameters_massive'],
|
||||
'return' => true,
|
||||
'min' => 100,
|
||||
'min' => $performance_variables_control['limit_parameters_massive']->min,
|
||||
'style' => 'width:50px',
|
||||
]
|
||||
);
|
||||
|
|
|
@ -53,6 +53,8 @@ $row = 0;
|
|||
echo '<form id="form_setup" method="post">';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
|
||||
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// BEHAVIOUR CONFIGURATION
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -68,11 +70,11 @@ $table_behaviour->data[$row][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 200,
|
||||
'max' => $performance_variables_control['block_size']->max,
|
||||
'name' => 'block_size',
|
||||
'value' => $config['global_block_size'],
|
||||
'return' => true,
|
||||
'min' => 10,
|
||||
'min' => $performance_variables_control['block_size']->min,
|
||||
'style' => 'width:50px',
|
||||
]
|
||||
);
|
||||
|
@ -838,11 +840,11 @@ $table_chars->data[$row][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 5,
|
||||
'max' => $performance_variables_control['graph_precision']->max,
|
||||
'name' => 'graph_precision',
|
||||
'value' => $config['graph_precision'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['graph_precision']->min,
|
||||
'style' => 'width:50px',
|
||||
($disabled_graph_precision) ? 'readonly' : '' => 'readonly',
|
||||
'onchange' => 'change_precision()',
|
||||
|
@ -859,11 +861,11 @@ $table_chars->data[$row][1] = html_print_input(
|
|||
[
|
||||
'type' => 'number',
|
||||
'size' => 5,
|
||||
'max' => 20,
|
||||
'max' => $performance_variables_control['short_module_graph_data']->max,
|
||||
'name' => 'short_module_graph_data',
|
||||
'value' => $config['short_module_graph_data'],
|
||||
'return' => true,
|
||||
'min' => 1,
|
||||
'min' => $performance_variables_control['short_module_graph_data']->min,
|
||||
'style' => 'width:50px',
|
||||
($disabled_graph_precision) ? 'readonly' : '' => 'readonly',
|
||||
'onchange' => 'change_precision()',
|
||||
|
|
|
@ -248,6 +248,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->checkAuditLogOldLocation();
|
||||
|
||||
/*
|
||||
* Check if performance variables are corrects
|
||||
*/
|
||||
$this->checkPerformanceVariables();
|
||||
|
||||
/*
|
||||
* Checks if sync queue is longer than limits.
|
||||
* NOTIF.SYNCQUEUE.LENGTH
|
||||
|
@ -509,6 +514,11 @@ class ConsoleSupervisor
|
|||
|
||||
$this->checkAuditLogOldLocation();
|
||||
|
||||
/*
|
||||
* Check if performance variables are corrects
|
||||
*/
|
||||
$this->checkPerformanceVariables();
|
||||
|
||||
/*
|
||||
* Checks if sync queue is longer than limits.
|
||||
* NOTIF.SYNCQUEUE.LENGTH
|
||||
|
@ -521,6 +531,76 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if performance variables are corrects
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkPerformanceVariables()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$names = [
|
||||
'event_purge' => 'Max. days before events are deleted',
|
||||
'trap_purge' => 'Max. days before traps are deleted',
|
||||
'audit_purge' => 'Max. days before audited events are deleted',
|
||||
'string_purge' => 'Max. days before string data is deleted',
|
||||
'gis_purge' => 'Max. days before GIS data is deleted',
|
||||
'days_purge' => 'Max. days before purge',
|
||||
'days_compact' => 'Max. days before data is compacted',
|
||||
'days_delete_unknown' => 'Max. days before unknown modules are deleted',
|
||||
'days_delete_not_initialized' => 'Max. days before delete not initialized modules',
|
||||
'days_autodisable_deletion' => 'Max. days before autodisabled agents are deleted',
|
||||
'delete_old_network_matrix' => 'Max. days before delete old network matrix data',
|
||||
'report_limit' => 'Item limit for real-time reports',
|
||||
'event_view_hr' => 'Default hours for event view',
|
||||
'big_operation_step_datos_purge' => 'Big Operation Step to purge old data',
|
||||
'small_operation_step_datos_purge' => 'Small Operation Step to purge old data',
|
||||
'row_limit_csv' => 'Row limit in csv log',
|
||||
'limit_parameters_massive' => 'Limit for bulk operations',
|
||||
'block_size' => 'Block size for pagination',
|
||||
'short_module_graph_data' => 'Data precision',
|
||||
'graph_precision' => 'Data precision in graphs',
|
||||
];
|
||||
|
||||
$variables = (array) json_decode(io_safe_output($config['performance_variables_control']));
|
||||
|
||||
foreach ($variables as $variable => $values) {
|
||||
if (empty($config[$variable]) === true || $config[$variable] === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$message = '';
|
||||
$limit_value = '';
|
||||
if ($config[$variable] > $values->max) {
|
||||
$message = 'Check the setting of %s, a value greater than %s is not recommended';
|
||||
$limit_value = $values->max;
|
||||
}
|
||||
|
||||
if ($config[$variable] < $values->min) {
|
||||
$message = 'Check the setting of %s, a value less than %s is not recommended';
|
||||
$limit_value = $values->min;
|
||||
}
|
||||
|
||||
if ($limit_value !== '' && $message !== '') {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
|
||||
'title' => __('Incorrect config value'),
|
||||
'message' => __(
|
||||
$message,
|
||||
$names[$variable],
|
||||
$limit_value
|
||||
),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Executes console maintenance operations. Executed ALWAYS through CRON.
|
||||
*
|
||||
|
|
|
@ -2293,6 +2293,96 @@ function config_process_config()
|
|||
config_update_value('2Fa_auth', '');
|
||||
}
|
||||
|
||||
if (isset($config['performance_variables_control']) === false) {
|
||||
config_update_value(
|
||||
'performance_variables_control',
|
||||
json_encode(
|
||||
[
|
||||
'event_purge' => [
|
||||
'max' => 45,
|
||||
'min' => 1,
|
||||
],
|
||||
'trap_purge' => [
|
||||
'max' => 45,
|
||||
'min' => 1,
|
||||
],
|
||||
'audit_purge' => [
|
||||
'max' => 365,
|
||||
'min' => 7,
|
||||
],
|
||||
'string_purge' => [
|
||||
'max' => 365,
|
||||
'min' => 7,
|
||||
],
|
||||
'gis_purge' => [
|
||||
'max' => 365,
|
||||
'min' => 7,
|
||||
],
|
||||
'days_purge' => [
|
||||
'max' => 365,
|
||||
'min' => 7,
|
||||
],
|
||||
'days_compact' => [
|
||||
'max' => 365,
|
||||
'min' => 0,
|
||||
],
|
||||
'days_delete_unknown' => [
|
||||
'max' => 90,
|
||||
'min' => 0,
|
||||
],
|
||||
'days_delete_not_initialized' => [
|
||||
'max' => 90,
|
||||
'min' => 0,
|
||||
],
|
||||
'days_autodisable_deletion' => [
|
||||
'max' => 90,
|
||||
'min' => 0,
|
||||
],
|
||||
'delete_old_network_matrix' => [
|
||||
'max' => 30,
|
||||
'min' => 1,
|
||||
],
|
||||
'report_limit' => [
|
||||
'max' => 500,
|
||||
'min' => 1,
|
||||
],
|
||||
'event_view_hr' => [
|
||||
'max' => 360,
|
||||
'min' => 1,
|
||||
],
|
||||
'big_operation_step_datos_purge' => [
|
||||
'max' => 10000,
|
||||
'min' => 100,
|
||||
],
|
||||
'small_operation_step_datos_purge' => [
|
||||
'max' => 10000,
|
||||
'min' => 100,
|
||||
],
|
||||
'row_limit_csv' => [
|
||||
'max' => 1000000,
|
||||
'min' => 1,
|
||||
],
|
||||
'limit_parameters_massive' => [
|
||||
'max' => 2000,
|
||||
'min' => 100,
|
||||
],
|
||||
'block_size' => [
|
||||
'max' => 200,
|
||||
'min' => 10,
|
||||
],
|
||||
'short_module_graph_data' => [
|
||||
'max' => 20,
|
||||
'min' => 1,
|
||||
],
|
||||
'graph_precision' => [
|
||||
'max' => 5,
|
||||
'min' => 1,
|
||||
],
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($config['agent_wizard_defaults']) === false) {
|
||||
config_update_value(
|
||||
'agent_wizard_defaults',
|
||||
|
|
|
@ -159,6 +159,7 @@ function notifications_get_subtypes(?string $source=null)
|
|||
'NOTIF.SERVER.STATUS',
|
||||
'NOTIF.SERVER.QUEUE',
|
||||
'NOTIF.SERVER.MASTER',
|
||||
'NOTIF.VARIABLES.PERFORMANCE',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue