';
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 4c09cde9ae..e18cfbd094 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -1868,6 +1868,12 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
}
}
} else {
+ // Delete only if the centralised mode is disabled.
+ if (is_central_policies_on_node()) {
+ returnError('centralized');
+ exit;
+ }
+
if ($agent_by_alias) {
$idsAgents = agents_get_agent_id_by_alias(io_safe_input($id));
} else {
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index f328000d44..f532fa5208 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -1143,6 +1143,11 @@ sub cli_delete_agent() {
$agent_name = decode_entities($agent_name);
+ if(is_metaconsole($conf) != 1 and pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
+ print_log "[ERROR] This node is configured with centralized mode. To delete an agent go to metaconsole. \n\n";
+ exit;
+ }
+
if (is_metaconsole($conf) == 1) {
if (not defined $use_alias) {
my $agents_groups = enterprise_hook('get_metaconsole_agent',[$dbh, $agent_name]);
|