Remove event replication.

When the load is high, event replication becomes a bottleneck. Events
will be read by the Metaconsole from the nodes themselves.
This commit is contained in:
Ramon Novoa 2022-05-31 10:52:32 +02:00
parent a2e036d279
commit d2dc87f0cc
5 changed files with 0 additions and 111 deletions

View File

@ -456,11 +456,6 @@ dataserver_lifo 0
policy_manager 1
# If set to 1, the event replicate process is enabled. 0 by default. (PANDORA FMS ENTERPRISE ONLY)
# WARNING: This process doesn't do anything if is not properly configured from the console setup
event_replication 0
# If set to 1, new events validate older event for the same module. This will
# affect the performance of the server. This was the "normal behaviour" on previous (4.x) versions.
# disable only if you really know what you are doing !!.

View File

@ -440,11 +440,6 @@ dataserver_lifo 0
policy_manager 1
# If set to 1, the event replicate process is enabled. 0 by default. (PANDORA FMS ENTERPRISE ONLY)
# WARNING: This process doesn't do anything if is not properly configured from the console setup
event_replication 0
# If set to 1, new events validate older event for the same module. This will
# affect the performance of the server. This was the "normal behaviour" on previous (4.x) versions.
# disable only if you really know what you are doing !!.

View File

@ -140,9 +140,6 @@ sub pandora_startup () {
# Start the policy queue thread.
start_server_thread(\&pandora_process_policy_queue, [\%Config]) if ($Config{'__enterprise_enabled'} == 1 && $Config{'policy_manager'} == 1);
# Start the event replication thread. Do not start with start_server_thread, this thread may exit on its own.
start_server_thread(\&pandora_process_event_replication, [\%Config]) if($Config{'__enterprise_enabled'} == 1 && $Config{'event_replication'} == 1);
pandora_audit (\%Config, $Config{'rb_product_name'} . ' Server Daemon starting', 'SYSTEM', 'System', $DBH);
# Load servers

View File

@ -155,10 +155,6 @@ sub pandora_get_sharedconfig ($$) {
# Pandora FMS Console's attachment directory
$pa_config->{"attachment_dir"} = pandora_get_tconfig_token ($dbh, 'attachment_store', '/var/www/pandora_console/attachment');
#Limit of events replicate in metaconsole
$pa_config->{'replication_limit'} = pandora_get_tconfig_token ($dbh, 'replication_limit', 1000);
$pa_config->{'include_agents'} = pandora_get_tconfig_token ($dbh, 'include_agents', 0);
#Public url
$pa_config->{'public_url'} = pandora_get_tconfig_token ($dbh, 'public_url', 'http://localhost/pandora_console');
@ -172,12 +168,6 @@ sub pandora_get_sharedconfig ($$) {
$pa_config->{"use_custom_encoding"} = pandora_get_tconfig_token ($dbh, 'use_custom_encoding', 0);
$pa_config->{"event_replication"} = pandora_get_tconfig_token ($dbh, 'event_replication', 0);
if ($pa_config->{'include_agents'} eq '') {
$pa_config->{'include_agents'} = 0;
}
# PandoraFMS product name
$pa_config->{'rb_product_name'} = enterprise_hook(
'pandora_get_product_name',
@ -438,9 +428,6 @@ sub pandora_load_config {
# Patrol process of policies queue
$pa_config->{"policy_manager"} = 0; # 5.0
# Event replication process
$pa_config->{"event_replication"} = 0; # 5.0
# Event auto-validation
$pa_config->{"event_auto_validation"} = 1; # 5.0
@ -537,8 +524,6 @@ sub pandora_load_config {
$pa_config->{"syslog_max"} = 65535; # 7.0.716
$pa_config->{"syslog_threads"} = 4; # 7.0.716
#$pa_config->{'include_agents'} = 0; #6.1
#
# External .enc files for XML::Parser.
$pa_config->{"enc_dir"} = ""; # > 6.0SP4
@ -1187,9 +1172,6 @@ sub pandora_load_config {
$pa_config->{'warmup_unknown_interval'}= clean_blank($1);
$pa_config->{'warmup_unknown_on'} = 0 if ($pa_config->{'warmup_unknown_interval'} == 0); # On by default.
}
#elsif ($parametro =~ m/^include_agents\s+([0-1])/i) {
# $pa_config->{'include_agents'}= clean_blank($1);
#}
elsif ($parametro =~ m/^enc_dir\s+(.*)/i) {
$pa_config->{'enc_dir'} = clean_blank($1);
}

View File

@ -229,7 +229,6 @@ our @EXPORT = qw(
pandora_planned_downtime_weekly_start
pandora_planned_downtime_weekly_stop
pandora_process_alert
pandora_process_event_replication
pandora_process_module
pandora_reset_server
pandora_safe_mode_modules_update
@ -5480,85 +5479,6 @@ sub pandora_server_statistics ($$) {
Process groups statistics for statistics table
=cut
##########################################################################
sub pandora_process_event_replication ($) {
my $pa_config = shift;
my $dbh_metaconsole;
my %pa_config = %{$pa_config};
# Get the console DB connection
my $dbh = db_connect ($pa_config{'dbengine'}, $pa_config{'dbname'}, $pa_config{'dbhost'}, $pa_config{'dbport'},
$pa_config{'dbuser'}, $pa_config{'dbpass'});
my $is_event_replication_enabled = enterprise_hook('get_event_replication_flag', [$dbh]);
my $replication_interval = enterprise_hook('get_event_replication_interval', [$dbh]);
# If there are not installed the enterprise version,
# desactivated the event replication or the replication
# interval is wrong: abort
if($is_event_replication_enabled == 0) {
db_disconnect($dbh);
return;
}
if($replication_interval <= 0) {
logger($pa_config, "The event replication interval must be greater than 0. Event replication aborted.", 1);
db_disconnect($dbh);
return;
}
logger($pa_config, "Started event replication thread.", 1);
while($THRRUN == 1) {
eval {{
local $SIG{__DIE__};
# Get the metaconsole DB connection
$dbh_metaconsole = enterprise_hook('get_metaconsole_dbh', [$pa_config, $dbh]);
$dbh_metaconsole = undef if $dbh_metaconsole eq '';
if (!defined($dbh_metaconsole)) {
logger($pa_config, "Metaconsole DB connection error. Event replication postponed.", 5);
next;
}
# Get server id on metaconsole
my $metaconsole_server_id = enterprise_hook('get_metaconsole_setup_server_id', [$dbh]);
# If the server name is not found in metaconsole setup: abort
if($metaconsole_server_id == -1) {
logger($pa_config, "The server name is not configured in metaconsole. Event replication postponed.", 5);
db_disconnect($dbh_metaconsole);
next;
}
my $replication_mode = enterprise_hook('get_event_replication_mode', [$dbh]);
while($THRRUN == 1) {
# If we are not the master server sleep and check again.
if (pandora_is_master($pa_config) == 0) {
sleep ($pa_config->{'server_threshold'});
next;
}
# Check the queue each N seconds
enterprise_hook('pandora_replicate_copy_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id, $replication_mode]);
sleep ($replication_interval);
}
}};
db_disconnect($dbh_metaconsole) if defined($dbh_metaconsole);
sleep ($replication_interval);
}
db_disconnect($dbh);
}
##########################################################################
=head2 C<< pandora_process_policy_queue (I<$pa_config>, I<$dbh>) >>
Process groups statistics for statistics table
=cut
##########################################################################
sub pandora_process_policy_queue ($) {