diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index d8e28223c6..d90e004c79 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 8628efb700..d2b9696269 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1469,11 +1469,20 @@ 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; - // Load enterprise extensions + defined('ENTERPRISE_DIR') || define('ENTERPRISE_DIR', 'enterprise'); + + // Load enterprise extensions. $filepath = realpath($config['homedir'].'/'.ENTERPRISE_DIR.'/'.$filename); if ($filepath === false) { @@ -1573,6 +1582,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; @@ -1580,6 +1594,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/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index a3cef76a26..20faec7fed 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"; } } }