diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 86dccfa53a..5b7e3ef0a9 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -19,8 +19,8 @@ if (isset($config['homedir'])) { ui_require_css_file('login'); -require_once $homedir.'include/functions_ui.php'; -require_once $homedir.'include/functions.php'; +require_once __DIR__.'/../include/functions_ui.php'; +require_once __DIR__.'/../include/functions.php'; require_once __DIR__.'/../include/functions_html.php'; diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 7266e9eff4..c0abbc4f1e 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -65,7 +65,7 @@ define('ERR_NODATA', -70000); define('ERR_CONNECTION', -80000); define('ERR_DISABLED', -90000); define('ERR_WRONG', -100000); -define('ERR_WRONG_NAME', -100001); +define('ERR_WRONG_MR', -100001); define('ERR_WRONG_PARAMETERS', -100002); define('ERR_ACL', -110000); define('ERR_AUTH', -120000); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index a680ad9cba..2525462793 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1475,6 +1475,13 @@ function enterprise_include($filename) } +/** + * Includes a file from enterprise section. + * + * @param string $filename Target file. + * + * @return mixed Result code. + */ function enterprise_include_once($filename) { global $config; @@ -1585,6 +1592,11 @@ function safe_sql_string($string) } +/** + * Verifies if current Pandora FMS installation is a Metaconsole. + * + * @return boolean True metaconsole installation, false if not. + */ function is_metaconsole() { global $config; @@ -1592,6 +1604,18 @@ function is_metaconsole() } +/** + * Check if current Pandora FMS installation has joined a Metaconsole env. + * + * @return boolean True joined, false if not. + */ +function has_metaconsole() +{ + global $config; + return (bool) $config['node_metaconsole'] && (bool) $config['metaconsole_node_id']; +} + + /** * @brief Check if there is management operations are allowed in current context * (node // meta) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index ec5582cfe8..ee66b5ca68 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -4810,7 +4810,7 @@ sub pandora_process_event_replication ($) { } # Get server id on metaconsole - my $metaconsole_server_id = enterprise_hook('get_metaconsole_setup_server_id', [$dbh_metaconsole, safe_input($pa_config->{'servername'})]); + my $metaconsole_server_id = enterprise_hook('get_metaconsole_setup_server_id', [$dbh]); # If the server name is not found in metaconsole setup: abort if($metaconsole_server_id == -1) { diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3daf10a6d4..bea31c2eb4 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -3801,9 +3801,8 @@ sub cli_get_agent_group() { else { my $id_group = get_agent_group ($dbh_metaconsole, $id_agent); my $group_name = get_group_name ($dbh_metaconsole, $id_group); - my $metaconsole_name = enterprise_hook('get_metaconsole_setup_server_name',[$dbh, $server]); $agent_name = safe_output($agent_name); - print "[INFO] Server: $metaconsole_name Agent: $agent_name Name Group: $group_name\n\n"; + print "[INFO] Agent: $agent_name Name Group: $group_name\n\n"; } } } @@ -3843,7 +3842,6 @@ sub cli_get_agent_group_id() { foreach my $server (@servers_id) { my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]); - my $metaconsole_name = enterprise_hook('get_metaconsole_setup_server_name',[$dbh, $server]); my $id_agent = get_agent_id($dbh_metaconsole,$agent_name); if ($id_agent == -1) { @@ -3852,7 +3850,7 @@ sub cli_get_agent_group_id() { else { my $id_group = get_agent_group ($dbh_metaconsole, $id_agent); $agent_name = safe_output($agent_name); - print "Server: $metaconsole_name Agent: $agent_name ID Group: $id_group\n\n"; + print "Agent: $agent_name ID Group: $id_group\n\n"; } } }