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; }