Merge branch 'ent-7869-solucion-automatica-splitbrain-pandora-ha' into 'develop'

PandoraHA Splitbrain autorecovery

See merge request artica/pandorafms!4413
This commit is contained in:
Daniel Rodriguez 2021-09-29 09:58:29 +00:00
commit f756cec3be
3 changed files with 30 additions and 16 deletions

View File

@ -702,3 +702,15 @@ alertserver_threads 4
# Generate an hourly warning event if alert execution is being delayed more than alertserver_warn seconds.
alertserver_warn 180
# Pandora FMS HA MySQL cluster splitbrain auto-recovery (PANDORA FMS ENTERPRISE ONLY)
# IMPORTANT! Please understand and configure all settings from pandora_console/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster&tab=setup
# before enable this feature.
#splitbrain_autofix 0
# Pandora FMS HA MySQL cluster splitbrain auto-recovery settings (PANDORA FMS ENTERPRISE ONLY)
# Maximum number of retries
#ha_max_splitbrain_retries 2
# Maximum number of retries to verify resync status.
#ha_max_resync_wait_retries 3
# Maximum number of seconds waiting while verifying resync status.
#ha_resync_sleep 10

View File

@ -1289,6 +1289,18 @@ sub pandora_load_config {
elsif ($parametro =~ m/^pandora_service_cmd\s(.*)/i) {
$pa_config->{'pandora_service_cmd'} = clean_blank($1);
}
elsif ($parametro =~ m/^splitbrain_autofix\s+([0-9]*)/i) {
$pa_config->{'splitbrain_autofix'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_max_resync_wait_retries\s+([0-9]*)/i) {
$pa_config->{'ha_max_resync_wait_retries'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_resync_sleep\s+([0-9]*)/i) {
$pa_config->{'ha_resync_sleep'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_max_splitbrain_retries\s+([0-9]*)/i) {
$pa_config->{'ha_max_splitbrain_retries'} = clean_blank($1);
}
} # end of loop for parameter #

View File

@ -49,11 +49,14 @@ my $Running = 0;
########################################################################
# Print the given message with a preceding timestamp.
########################################################################
sub log_message($$$) {
my ($conf, $source, $message) = @_;
sub log_message($$$;$) {
my ($conf, $source, $message, $verbosity_level) = @_;
my $level = $verbosity_level;
$level = 5 unless defined($level);
if (ref($conf) eq "HASH") {
logger($conf, 'HA (' . $source . ') ' . "$message", 5);
logger($conf, 'HA (' . $source . ') ' . "$message", $level);
}
if ($source eq '') {
@ -403,19 +406,6 @@ END {
stop();
}
###############################################################################
# Aux. get module id
###############################################################################
my %module_id;
sub __get_module_id {
my ($dbh, $module_type) = @_;
if (!defined($module_id{$module_type})) {
$module_id{$module_type} = get_module_id($dbh, $module_type);
}
return $module_id{$module_type}
}
$SIG{INT} = \&stop;
$SIG{TERM} = \&stop;