diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index d8760caa1a..6f005e607c 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1416,14 +1416,6 @@ function graphic_combined_module( $labels = []; $modules = []; foreach ($sources as $source) { - $id_agent = agents_get_module_id( - $source['id_agent_module'] - ); - - if (!$id_agent) { - continue; - } - if (is_metaconsole() === true) { metaconsole_restore_db(); $server = metaconsole_get_connection_by_id($source['id_server']); @@ -1432,6 +1424,14 @@ function graphic_combined_module( } } + $id_agent = agents_get_module_id( + $source['id_agent_module'] + ); + + if (!$id_agent) { + continue; + } + $modulepush = [ 'server' => (isset($source['id_server']) === true) ? $source['id_server'] : 0, 'module' => $source['id_agent_module'], diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php b/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php index cc0c365576..6f5a248a78 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php @@ -612,6 +612,9 @@ final class ModuleGraph extends Item // Custom graph. $fields = self::getListCustomGraph(); + $selected_custom_graph = (\is_metaconsole() === true) + ? $values['customGraphId'].'|'.$values['metaconsoleId'] + : $values['customGraphId']; $inputs[] = [ 'id' => 'MGcustomGraph', 'hidden' => $hiddenCustom, @@ -620,7 +623,7 @@ final class ModuleGraph extends Item 'type' => 'select', 'fields' => $fields, 'name' => 'customGraphId', - 'selected' => $values['customGraphId'], + 'selected' => $selected_custom_graph, 'return' => true, 'nothing' => __('None'), 'nothing_value' => 0,