From c5588197f2612a1803716e896d6ca94c5e7bfaab Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 23 Nov 2021 12:23:27 +0100 Subject: [PATCH] #8224 centralised node check added --- pandora_server/util/pandora_manage.pl | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 04ee72ea70..1480decba4 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -353,6 +353,11 @@ sub pandora_disable_group ($$$) { my @agents_bd = []; my $result = 0; + if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { + print_log "[ERROR] This node is configured with centralized mode. To disable a group go to metaconsole. \n\n"; + exit; + } + if ($group == 0){ # Extract all the names of the pandora agents if it is for all = 0. @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente'); @@ -390,6 +395,11 @@ sub pandora_enable_group ($$$) { my @agents_bd = []; my $result = 0; + if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { + print_log "[ERROR] This node is configured with centralized mode. To enable a group go to metaconsole. \n\n"; + exit; + } + if ($group == 0){ # Extract all the names of the pandora agents if it is for all = 0. @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente'); @@ -5850,7 +5860,12 @@ sub cli_get_planned_downtimes_items() { sub cli_create_group() { my ($group_name,$parent_group_name,$icon,$description) = @ARGV[2..5]; - + + if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { + print_log "[ERROR] This node is configured with centralized mode. To create a group go to metaconsole. \n\n"; + exit; + } + my $group_id = get_group_id($dbh,$group_name); non_exist_check($group_id, 'group name', $group_name); @@ -5922,6 +5937,11 @@ sub cli_create_group() { sub cli_delete_group() { my ($group_name) = @ARGV[2]; + if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { + print_log "[ERROR] This node is configured with centralized mode. To delete a group go to metaconsole. \n\n"; + exit; + } + my $group_id = get_group_id($dbh,$group_name); exist_check($group_id, 'group name', $group_name); @@ -5946,6 +5966,11 @@ sub cli_update_group() { my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6]; my $result; + if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { + print_log "[ERROR] This node is configured with centralized mode. To update a group go to metaconsole. \n\n"; + exit; + } + $result = get_db_value ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); if($result == "0E0"){