From 5ef49024bf33edcb46bdb8100c3366b49a76e213 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 23 May 2024 12:53:53 +0200 Subject: [PATCH 1/3] #13783 change macros when no sync meta and node --- pandora_console/include/functions_events.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index ae5a814a3a..22ecada817 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3841,6 +3841,11 @@ function events_get_response_target( include_once $config['homedir'].'/vendor/autoload.php'; + if (is_metaconsole() === true && (int) $server_id > 0) { + $node = new Node($server_id); + $node->connect(); + } + try { $eventObjt = new PandoraFMS\Event($event_id); } catch (Exception $e) { @@ -4238,6 +4243,10 @@ function events_get_response_target( ); } + if (is_metaconsole() === true && $server_id > 0) { + $node->disconnect(); + } + return $target; } From 61040b79919969c3c7739621708275d84eb7ad41 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 24 May 2024 11:30:42 +0200 Subject: [PATCH 2/3] #13783 fix conect node event meta --- pandora_console/include/functions_events.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 22ecada817..3a17a8c8a0 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3841,18 +3841,23 @@ function events_get_response_target( include_once $config['homedir'].'/vendor/autoload.php'; - if (is_metaconsole() === true && (int) $server_id > 0) { - $node = new Node($server_id); - $node->connect(); - } - try { $eventObjt = new PandoraFMS\Event($event_id); } catch (Exception $e) { $eventObjt = new PandoraFMS\Event(); } + if (is_metaconsole() === true && (int) $server_id > 0) { + $node = new Node($server_id); + $node->connect(); + } + $event = db_get_row('tevento', 'id_evento', $event_id); + + if (is_metaconsole() === true && $server_id > 0) { + $node->disconnect(); + } + $target = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id'])); // Replace parameters response. @@ -4243,10 +4248,6 @@ function events_get_response_target( ); } - if (is_metaconsole() === true && $server_id > 0) { - $node->disconnect(); - } - return $target; } From 23282e0ca3ac046aa031d5d3d96ec3f72d4b709c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 24 May 2024 11:39:53 +0200 Subject: [PATCH 3/3] #13783 fix macros --- pandora_console/include/functions_events.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 3a17a8c8a0..caf039656d 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3887,6 +3887,11 @@ function events_get_response_target( } } + if (is_metaconsole() === true && (int) $server_id > 0) { + $node = new Node($server_id); + $node->connect(); + } + // Replace macros. if (strpos($target, '_agent_alias_') !== false) { $agente_table_name = 'tagente'; @@ -4248,6 +4253,10 @@ function events_get_response_target( ); } + if (is_metaconsole() === true && $server_id > 0) { + $node->disconnect(); + } + return $target; }