diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 9f6e105ef5..91c86c0325 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -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 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 226fb68e83..c5b6645727 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -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 # diff --git a/pandora_server/util/pandora_ha.pl b/pandora_server/util/pandora_ha.pl index ac8774972c..a9d07ca66a 100755 --- a/pandora_server/util/pandora_ha.pl +++ b/pandora_server/util/pandora_ha.pl @@ -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;