From e6d2cc3cfa496b218faa8acd2a4d426f8ae116b2 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 23 Feb 2023 13:22:38 +0100 Subject: [PATCH] #9893 changed HA view and connect --- .../general/first_task/HA_cluster_builder.php | 64 ------------------- pandora_console/include/config_process.php | 13 ++++ pandora_console/include/constants.php | 2 + 3 files changed, 15 insertions(+), 64 deletions(-) delete mode 100644 pandora_console/general/first_task/HA_cluster_builder.php diff --git a/pandora_console/general/first_task/HA_cluster_builder.php b/pandora_console/general/first_task/HA_cluster_builder.php deleted file mode 100644 index e475dfdf1a..0000000000 --- a/pandora_console/general/first_task/HA_cluster_builder.php +++ /dev/null @@ -1,64 +0,0 @@ - true, 'message' => __('There are no HA clusters defined yet.') ]); -?> - -
-
- __('Clusters')]); ?> -
-
-

-

-
'; - - echo __('Click on "add new node" to start transforming your Pandora FMS DB Cluster into a Pandora FMS DB Cluster.').'

'; - ?> -

- -
"; - echo ""; - ?> - - -
- diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index d1edec1366..2d03687881 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -153,6 +153,19 @@ if (! defined('ENTERPRISE_DIR')) { } db_select_engine(); + +if (empty($config['remote_config']) === false + && file_exists($config['remote_config'].'/'.PANDORA_HA_FILE) + && filesize($config['remote_config'].'/'.PANDORA_HA_FILE) > 0 +) { + $data = file_get_contents($config['remote_config'].'/'.PANDORA_HA_FILE); + if (empty($data) === false) { + $ip_list = explode(',', $data); + // Connects to the first pandora_ha_dbs.conf database. + $config['dbhost'] = trim($ip_list[0]); + } +} + $config['dbconnection'] = db_connect(); require_once $ownDir.'functions_config.php'; diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 18b32b6de4..e1497b8c42 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -864,3 +864,5 @@ define( // Pandora FMS Enterprise license. define('LICENSE_FILE', 'customer_key'); +// Pandora HA database list. +define('PANDORA_HA_FILE', 'pandora_ha_dbs.conf');