From 2e764afac7ca3e8055ce8fbdf5a13e027a51df11 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 15 Sep 2021 21:38:10 +0200 Subject: [PATCH] PandoraHA Splitbrain autorecovery --- pandora_server/conf/pandora_server.conf.new | 4 ++++ pandora_server/lib/PandoraFMS/Config.pm | 3 +++ pandora_server/util/pandora_ha.pl | 13 ------------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index d9ea96e6b7..979ac60d04 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -707,3 +707,7 @@ 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 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 47c1c5c660..b718e381d7 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -1290,6 +1290,9 @@ 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(.*)/i) { + $pa_config->{'splitbrain_autofix'} = 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..8794d38c9d 100755 --- a/pandora_server/util/pandora_ha.pl +++ b/pandora_server/util/pandora_ha.pl @@ -403,19 +403,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;