From 2150272903587054e9bf56719fe8e7806ccf15dd Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 25 Mar 2024 15:59:41 +0100 Subject: [PATCH] #11634 deleted ha legacy from backend --- pandora_server/conf/pandora_server.conf.new | 3 - pandora_server/lib/PandoraFMS/Config.pm | 6 -- pandora_server/util/pandora_ha.pl | 90 +-------------------- 3 files changed, 1 insertion(+), 98 deletions(-) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 48c6c6288d..8dcb2ee0f4 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -714,9 +714,6 @@ ncm_ssh_utility /usr/share/pandora_server/util/ncm_ssh_extension # Pandora FMS Daemon Watchdog execution interval in seconds (PANDORA FMS ENTERPRISE ONLY). ha_interval 30 -# HA operation mode. For backward compatibility with pacemaker. Do not change this value (PANDORA FMS ENTERPRISE ONLY). -ha_mode pandora - # Comma separated list of HA host IPs or FQDNs (PANDORA FMS ENTERPRISE ONLY). #ha_hosts 172.16.0.8,172.168.0.16 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index eebf94fdf6..98c97f3f4c 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -566,7 +566,6 @@ sub pandora_load_config { $pa_config->{"netflowserver"} = 0; # 7.0.770 $pa_config->{"netflowserver_threads"} = 1; # 7.0.770 - $pa_config->{"ha_mode"} = "pacemaker"; # 7.0.770 $pa_config->{"ha_file"} = undef; # 7.0.770 $pa_config->{"ha_hosts_file"} = '/var/spool/pandora/data_in/conf/pandora_ha_hosts.conf'; # 7.0.770 $pa_config->{"ha_connect_retries"} = 2; # 7.0.770 @@ -1338,11 +1337,6 @@ sub pandora_load_config { elsif ($parametro =~ m/^ncm_ssh_utility\s+(.*)/i) { $pa_config->{'ncm_ssh_utility'}= clean_blank($1); } - - # Pandora HA extra - elsif ($parametro =~ m/^ha_mode\s(.*)/i) { - $pa_config->{'ha_mode'} = clean_blank($1); - } elsif ($parametro =~ m/^ha_file\s(.*)/i) { $pa_config->{'ha_file'} = clean_blank($1); } diff --git a/pandora_server/util/pandora_ha.pl b/pandora_server/util/pandora_ha.pl index 28ae0df795..57b2de44b5 100755 --- a/pandora_server/util/pandora_ha.pl +++ b/pandora_server/util/pandora_ha.pl @@ -539,89 +539,6 @@ sub ha_restart_pandora($) { `$config->{'pandora_service_cmd'} $control_command 2>/dev/null`; } -############################################################################### -# Main (Pacemaker) -############################################################################### -sub ha_main_pacemaker($) { - my ($conf) = @_; - - # Set the PID file. - $conf->{'PID'} = $PID_FILE; - - # Log to a separate file if needed. - $conf->{'log_file'} = $conf->{'ha_log_file'} if defined ($conf->{'ha_log_file'}); - - $Running = 1; - - ha_daemonize($conf) if ($DAEMON == 1); - - while ($Running) { - eval { - eval { - local $SIG{__DIE__}; - # Load enterprise components. - enterprise_load($conf, 1); - - # Register Enterprise logger - enterprise_hook('pandoraha_logger', [\&log_message]); - log_message($conf, 'LOG', 'Enterprise capabilities loaded'); - - }; - if ($@) { - # No enterprise capabilities. - log_message($conf, 'LOG', 'No enterprise capabilities'); - } - - # Start the Pandora FMS server if needed. - log_message($conf, 'LOG', 'Checking the pandora_server service.'); - - # Connect to a DB. - my $dbh = ha_database_connect($conf); - - if ($First_Cleanup == 1) { - log_message($conf, 'LOG', 'Cleaning previous unfinished actions'); - enterprise_hook('pandoraha_cleanup_states', [$conf, $dbh]); - $First_Cleanup = 0; - } - - # Check if there are updates pending. - ha_update_server($conf, $dbh); - - # Keep pandora running - ha_keep_pandora_running($conf, $dbh); - - # Keep Tentacle running - ha_keep_tentacle_running($conf, $dbh); - - # Keep MADE running - ha_keep_made_running($conf, $dbh); - - # Are we the master? - pandora_set_master($conf, $dbh); - if (!pandora_is_master($conf)) { - log_message($conf, 'LOG', $conf->{'servername'} . ' is not the current master. Skipping DB-HA actions and monitoring.'); - # Exit current eval. - return; - } - - # Synchronize database. - enterprise_hook('pandoraha_sync_node', [$conf, $dbh]); - - # Monitoring. - enterprise_hook('pandoraha_monitoring', [$conf, $dbh]); - - # Pending actions. - enterprise_hook('pandoraha_process_queue', [$conf, $dbh, $First_Cleanup]); - - # Cleanup and exit - db_disconnect ($dbh); - }; - log_message($conf, 'WARNING', $@) if ($@); - - log_message($conf, 'LOG', "Sleep."); - sleep($conf->{'ha_interval'}); - } -} ############################################################################### # Main (Pandora) @@ -763,11 +680,6 @@ ha_init_pandora(\%Conf); # Read config file ha_load_pandora_conf (\%Conf); -# Main -if (defined($Conf{'ha_mode'}) && lc($Conf{'ha_mode'}) eq 'pandora') { - ha_main_pandora(\%Conf); -} else { - ha_main_pacemaker(\%Conf); -} +ha_main_pandora(\%Conf); exit 0;