Merge branch 'develop' into ent-12934-cambio-sistema-despliegue-de-agentes

This commit is contained in:
Daniel Cebrian 2024-04-01 10:42:22 +02:00
commit 33caead3be
8 changed files with 7 additions and 111 deletions

View File

@ -1747,3 +1747,5 @@ enterprise/include/class/MySQL.app.php
enterprise/include/class/Oracle.app.php
enterprise/include/class/SAP.app.php
enterprise/include/class/VMware.app.php
enterprise/include/class/DatabaseHA.class.php
enterprise/godmode/servers/HA_cluster.php

View File

@ -7706,6 +7706,7 @@ UPDATE `twelcome_tip` SET url = 'https://pandorafms.com/manual/!current/start?id
UPDATE `twelcome_tip` SET url = 'https://pandorafms.com/manual/!current/start?id=en/documentation/02_installation/05_configuration_agents#conf' WHERE title = 'Automatic agent provision system';
UPDATE `twelcome_tip` SET url = 'https://pandorafms.com/manual/!current/start?id=en/documentation/04_using/05_data_presentation_visual_maps' WHERE title = 'Using custom icons in visual consoles';
DELETE FROM tconfig WHERE `token` = 'legacy_database_ha';
-- Add new columns in tdeployment_hosts
ALTER TABLE `tdeployment_hosts` ADD COLUMN `deploy_method` ENUM('SSH', 'HTTP', 'HTTPS') DEFAULT 'SSH';

View File

@ -133,14 +133,12 @@ foreach ($servers as $server) {
__('Server has crashed.'),
true
);
} else if ((int) ($server['disabled'] == 1)){
} else if ((int) ($server['disabled'] == 1)) {
$data[1] = ui_print_status_image(
STATUS_SERVER_STANDBY,
__('Server was manually disabled.'),
true
);
} else if ((int) ($server['status'] === 0)
|| (($date - $server_keepalive) > ($server['server_keepalive']) * 2)
) {

View File

@ -3015,7 +3015,7 @@ class ConsoleSupervisor
public function checkHaStatus()
{
global $config;
enterprise_include_once('include/class/DatabaseHA.class.php');
enterprise_include_once('include/class/NewDatabaseHA.class.php');
$cluster = new DatabaseHA();
$nodes = $cluster->getNodes();
@ -3038,7 +3038,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.HAMASTER.MESSAGE',
'title' => __('Desynchronized operation on the node '.$node['host']),
'message' => __($message),
'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster',
'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/new_HA_cluster',
'icon_notification' => self::ICON_ERROR,
]
);

View File

@ -505,10 +505,6 @@ function config_update_config()
$error_update[] = __('Enable Update Manager');
}
if (config_update_value('legacy_database_ha', get_parameter('legacy_database_ha'), true) === false) {
$error_update[] = __('Legacy database HA');
}
if (config_update_value('agent_vulnerabilities', get_parameter('agent_vulnerabilities'), true) === false) {
$error_update[] = __('agent_vulnerabilities');
}
@ -2430,10 +2426,6 @@ function config_process_config()
config_update_value('enable_update_manager', 1);
}
if (!isset($config['legacy_database_ha'])) {
config_update_value('legacy_database_ha', 0);
}
if (!isset($config['disabled_newsletter'])) {
config_update_value('disabled_newsletter', 0);
}

View File

@ -717,9 +717,6 @@ agent_deployer_utility /usr/share/pandora_server/util/pandora_agent_deployer
# 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

View File

@ -568,7 +568,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
@ -1343,11 +1342,6 @@ sub pandora_load_config {
elsif ($parametro =~ m/^agent_deployer_utility\s+(.*)/i) {
$pa_config->{'agent_deployer_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);
}

View File

@ -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;