diff --git a/pandora_console/godmode/agentes/module_manager_editor_web.php b/pandora_console/godmode/agentes/module_manager_editor_web.php index 281963108a..727e16d5bf 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_web.php +++ b/pandora_console/godmode/agentes/module_manager_editor_web.php @@ -113,7 +113,8 @@ if ($id_policy_module > 0) { $plugin_parameter_split = explode(' ', $plugin_parameter); $plugin_parameter_final_split = ''; -foreach ($plugin_parameter_split as $key => $value) { +$new_plugin_parameter_split = array_filter($plugin_parameter_split, 'strlen'); +foreach ($new_plugin_parameter_split as $key => $value) { if (strpos($value, 'http_auth_user') === false && strpos($value, 'http_auth_pass') === false) { $plugin_parameter_final_split .= $value.' '; } @@ -317,8 +318,7 @@ foreach ($texts as $code => $text) { return; } - $(plugin_parameter).val( - 'task_begin\ncookie 0\nresource 0\ntask_end'); + $(plugin_parameter).val('task_begin\ncookie 0\nresource 0\ntask_end'); $('#button-btn_loadbasic').attr('disabled', 'disabled'); diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index b972e1ff5a..97a492809e 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -333,7 +333,7 @@ $show_table_filter .= ui_toggle( __('Search'), 'search', true, - false, + true, '', 'white-box-content no_border', 'filter-datatable-main box-flat white_table_graph fixed_filter_bar ' diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index b68ae38162..de01a947ff 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -40,29 +40,47 @@ $table->size = []; $table->style[0] = 'width: 50%'; $table->style[1] = 'width: 50%'; -// Add an agent selector -if (! $id_agente) { +if (is_metaconsole() === true) { $params = []; $params['return'] = true; $params['show_helptip'] = true; $params['input_name'] = 'id_agent'; $params['selectbox_id'] = 'id_agent_module'; $params['javascript_is_function_select'] = true; - $params['metaconsole_enabled'] = false; + $params['metaconsole_enabled'] = true; $params['use_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true; + $params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax'; + $table->data[0][0] = html_print_label_input_block( __('Agent'), - ui_print_agent_autocomplete_input($params) + '
'.ui_print_agent_autocomplete_input($params).'
' ); +} else { + // Add an agent selector. + if (! $id_agente) { + $params = []; + $params['return'] = true; + $params['show_helptip'] = true; + $params['input_name'] = 'id_agent'; + $params['selectbox_id'] = 'id_agent_module'; + $params['javascript_is_function_select'] = true; + $params['metaconsole_enabled'] = false; + $params['use_hidden_input_idagent'] = true; + $params['print_hidden_input_idagent'] = true; + $table->data[0][0] = html_print_label_input_block( + __('Agent'), + ui_print_agent_autocomplete_input($params) + ); + } + + if ($id_agente) { + $modules = agents_get_modules($id_agente, false, ['delete_pending' => 0]); + } } $modules = []; -if ($id_agente) { - $modules = agents_get_modules($id_agente, false, ['delete_pending' => 0]); -} - $table->data[0][1] = html_print_label_input_block( __('Module'), html_print_select( @@ -319,7 +337,8 @@ $(document).ready (function () { jQuery.post ( + "ajax.php", {"page" : "operation/agentes/estado_agente", "get_agent_module_last_value" : 1, - "id_agent_module" : this.value + "id_agent_module" : this.value, + "server_name" : $('#text-id_agent').val(), }, function (data, status) { if (data === false) { @@ -338,5 +357,4 @@ $(document).ready (function () { ); }); }); -/* ]]> */ diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index 828901f2bf..17669ab248 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -99,6 +99,19 @@ if ($update_alert) { } if ($create_alert) { + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $server_name = explode(' ', io_safe_output(get_parameter('id_agent')))[0]; + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + $id_alert_template = (int) get_parameter('template'); $id_agent_module = (int) get_parameter('id_agent_module'); @@ -203,9 +216,28 @@ if ($create_alert) { } } } + + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + echo ''; + } } if ($delete_alert) { + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $server_name = explode(' ', io_safe_output(get_parameter('id_agent')))[0]; + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + $id_alert_agent_module = (int) get_parameter('id_alert'); $temp = db_get_row('talert_template_modules', 'id', $id_alert_agent_module); @@ -241,9 +273,27 @@ if ($delete_alert) { '', true ); + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + echo ''; + } } if ($add_action) { + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $server_name = explode(' ', io_safe_output(get_parameter('id_agent')))[0]; + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + $id_action = (int) get_parameter('action_select'); $id_alert_module = (int) get_parameter('id_alert_module'); $fires_min = (int) get_parameter('fires_min'); @@ -280,9 +330,28 @@ if ($add_action) { '', true ); + + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + echo ''; + } } if ($update_action) { + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $server_name = explode(' ', io_safe_output(get_parameter('id_agent')))[0]; + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + $alert_id = (int) get_parameter('alert_id'); $id_action = (int) get_parameter('action_select_ajax-'.$alert_id); $id_module_action = (int) get_parameter('id_module_action_ajax'); @@ -321,9 +390,28 @@ if ($update_action) { '', true ); + + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + echo ''; + } } if ($delete_action) { + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $server_name = explode(' ', io_safe_output(get_parameter('id_agent')))[0]; + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + $id_action = (int) get_parameter('id_action'); $id_alert = (int) get_parameter('id_alert'); @@ -348,6 +436,12 @@ if ($delete_action) { '', true ); + + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + echo ''; + } } if ($enable_alert) { diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php index cd5a271971..3a71292aed 100644 --- a/pandora_console/godmode/alerts/alert_view.php +++ b/pandora_console/godmode/alerts/alert_view.php @@ -326,9 +326,22 @@ if (count($actions) == 1 && isset($actions[0])) { } foreach ($action['escalation'] as $k => $v) { - if (count($table->head) >= count($action['escalation'])) { - if ($k === count($action['escalation'])) { - if ($k === 1) { + if ($v > 0) { + $table->data[$kaction][$k] .= html_print_image( + 'images/tick.png', + true, + ['class' => 'invert_filter'] + ); + } else { + $table->data[$kaction][$k] = html_print_image( + 'images/blade.png', + true + ); + } + + if (count($table->head) <= count($action['escalation'])) { + if ($k == count($action['escalation'])) { + if ($k == 1) { $table->head[$kaction] = __('Every time that the alert is fired'); } else { $table->head[$kaction] = '>#'.($kaction - 1); diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index baa3c2e6a5..5ec67b09a7 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -287,7 +287,7 @@ foreach ($extensions as $file => $extension) { [ 'href' => 'index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file, 'image' => 'images/lightbulb_off.png', - 'title' => __('Delete'), + 'title' => __('Enable'), ], true ); @@ -305,7 +305,7 @@ foreach ($extensions as $file => $extension) { [ 'href' => 'index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&disabled='.$file, 'image' => 'images/lightbulb.png', - 'title' => __('Delete'), + 'title' => __('Disable'), ], true ); diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index 2e519ef91a..2fbda5d75c 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -419,6 +419,19 @@ if ($get_actions_module) { } if ($show_update_action_menu) { + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $server_name = explode(' ', io_safe_output(get_parameter('id_agent')))[0]; + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + if (! check_acl($config['id_user'], 0, 'LW')) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, @@ -449,7 +462,12 @@ if ($show_update_action_menu) { $id_action ); - $data .= '
'; + if (is_metaconsole()) { + $data .= ''; + } else { + $data .= ''; + } + $data .= ''; $data .= html_print_input_hidden( 'update_action', @@ -466,6 +484,11 @@ if ($show_update_action_menu) { $id_action, true ); + $data .= html_print_input_hidden( + 'id_agent', + $server_name, + true + ); if (! $id_agente) { $data .= ''; $data .= ''; $data .= ''; + + if (isset($action_option['module_action_threshold']) === false) { + $action_option['module_action_threshold'] = '300'; + } + $data .= ''; $data .= ''; $data .= ''; @@ -584,6 +612,11 @@ if ($show_update_action_menu) { true ); $data .= ''; + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + } + echo $data; return; } @@ -954,6 +987,7 @@ if ($get_agent_alerts_datatable === true) { $tmp->last_fired = $row[8]; $tmp->status = $row[9]; $tmp->validate = $row[10]; + $tmp->actions = $row[11]; } else { // Open. $tmp->standby = $row[0]; diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index d98057b97c..eec1ba849e 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1562,13 +1562,13 @@ function alerts_delete_alert_agent_module_action($id_alert_agent_module_action) * * @return mixed Actions associated or false if something goes wrong. */ -function alerts_get_alert_agent_module_actions($id_alert_agent_module, $fields=false, $server_id=-1) +function alerts_get_alert_agent_module_actions($id_alert_agent_module, $fields=false, $server_id=-1, $ignore_metaconsole=false) { if (empty($id_alert_agent_module)) { return false; } - if (defined('METACONSOLE')) { + if (defined('METACONSOLE') && $ignore_metaconsole === false) { $server = db_get_row('tmetaconsole_setup', 'id', $server_id); if (metaconsole_connect($server) == NOERR) { @@ -1602,6 +1602,7 @@ function alerts_get_alert_agent_module_actions($id_alert_agent_module, $fields=f $action['fires_min'] = $element['fires_min']; $action['fires_max'] = $element['fires_max']; $action['module_action_threshold'] = $element['module_action_threshold']; + $action['original_id'] = $element['id']; if (isset($element['id'])) { $retval[$element['id']] = $action; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 1407dd3421..f50f2d56e4 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1148,6 +1148,7 @@ function ui_format_alert_row( 'last_fired' => 8, 'status' => 9, 'validate' => 10, + 'actions' => 11, ]; } else { $index = [ @@ -1417,7 +1418,8 @@ function ui_format_alert_row( ); } - $data[$index['module_name']] = ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[…]', ''); + $alert_module_name = isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']); + $data[$index['module_name']] = ui_print_truncate_text($alert_module_name, 'module_small', false, true, true, '[…]', ''); } $data[$index['agent_name']] .= $disabledHtmlEnd; @@ -1431,7 +1433,24 @@ function ui_format_alert_row( $data[$index['description']] .= $disabledHtmlStart.ui_print_truncate_text(io_safe_output($description), 'description', false, true, true, '[…]', '').$disabledHtmlEnd; - $actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']); + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $connection = metaconsole_get_connection($agente['server_name']); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + + $actions = alerts_get_alert_agent_module_actions($alert['id'], false, -1, true); + + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + } if (empty($actions) === false || $actionDefault != '') { $actionText = '
'; } $actionText .= ''; - if ($actionDefault !== '') { + if ($actionDefault !== '' && $actionDefault !== false) { $actionDefault_name = db_get_sql( sprintf( 'SELECT name FROM talert_actions WHERE id = %d', @@ -1456,6 +1507,8 @@ function ui_format_alert_row( foreach ($actions as $action) { if ($actionDefault_name === $action['name']) { $hide_actionDefault = true; + } else { + $hide_actionDefault = false; } } @@ -1484,6 +1537,182 @@ function ui_format_alert_row( } $data[$index['status']] = ui_print_status_image($status, $title, true); + $data[$index['status']] .= '
'; @@ -548,6 +571,11 @@ if ($show_update_action_menu) { ); $data .= '
'; $data .= __('Threshold').ui_print_help_tip(__('If a value of 0 is assigned, the Threshold of the action will be used.'), true); @@ -568,7 +596,7 @@ if ($show_update_action_menu) { false, '', false, - true + false ); $data .= '
'; + $data[$index['actions']] .= html_print_input_hidden('add_action', 1, true); + $data[$index['actions']] .= html_print_input_hidden('id_agent', $agente['alias'], true); + $data[$index['actions']] .= html_print_input_hidden('id_alert_module', $alert['id'], true); + + if (! $id_agente) { + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + } + + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + $data[$index['actions']] .= '
'.html_print_label_input_block( + __('Agent'), + ui_print_truncate_text($agente['alias'], 'agent_small', false, true, true, '[…]') + ).''.html_print_label_input_block( + __('Module'), + ui_print_truncate_text($alert_module_name, 'module_small', false, true, true, '[…]') + ).'
'.html_print_label_input_block( + __('Action'), + html_print_select( + $actions, + 'action_select', + '', + '', + __('None'), + 0, + true, + false, + true, + '', + false, + 'width:100%' + ) + ).''.html_print_label_input_block( + __('Number of alerts match from'), + '
'.html_print_input_text( + 'fires_min', + 0, + '', + 4, + 10, + true, + false, + false, + '', + 'w40p' + ).' '.__('to').' '.html_print_input_text( + 'fires_max', + 0, + '', + 4, + 10, + true, + false, + false, + '', + 'w40p' + ).'
' + ).'
'.html_print_label_input_block( + __('Threshold'), + html_print_extended_select_for_time( + 'module_action_threshold', + 0, + '', + '', + '', + false, + true, + false, + true, + '', + false, + false, + '', + false, + true + ) + ).'
'; + $data[$index['actions']] .= html_print_submit_button( + __('Add'), + 'addbutton', + false, + [ + 'icon' => 'next', + 'class' => 'mini float-right', + ], + true + ); + $data[$index['actions']] .= ''; + $data[$index['actions']] .= ''; + } return $data; } @@ -3652,6 +3881,8 @@ function ui_print_datatable(array $parameters) } else { $pagination_options = [ [ + // There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows. + // -1 Retun error or only 1 row. $parameters['default_pagination'], 5, 10, @@ -3660,7 +3891,7 @@ function ui_print_datatable(array $parameters) 200, 500, 1000, - -1, + 18446744073709551615, ], [ $parameters['default_pagination'], diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 49abe7da3e..4d41d12b8e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -7303,6 +7303,9 @@ div.graph div.legend table { .vertical_middle { vertical-align: middle; } +.vertical_baseline { + vertical-align: baseline !important; +} .mrg_btt_7 { margin-bottom: 7px; diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 039b1cdcc0..4db865990f 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -312,12 +312,18 @@ if (is_metaconsole() === false) { } } +if (is_metaconsole()) { + array_push($column_names, ['text' => 'actions']); + array_push($columns, 'actions'); +} + if (is_metaconsole() === true) { $no_sortable_columns = [ 0, 1, 2, 5, + -1, ]; } else { if (enterprise_installed() === true) { @@ -466,7 +472,17 @@ if (is_metaconsole() === false) { } } } else { - html_print_action_buttons(''); + echo "
"; + html_print_action_buttons( + html_print_submit_button( + __('Create alert'), + 'submit', + false, + [ 'icon' => 'next'], + true + ) + ); + echo '
'; } $html_content = ob_get_clean(); @@ -509,97 +525,153 @@ ui_require_jquery_file('cluetip'); +}).change(); + +function validateAlerts() { + var alert_ids = []; + + $('[id^=checkbox-validate]:checked').each(function() { + alert_ids.push($(this).val()); + }); + + if (alert_ids.length === 0) { + confirmDialog({ + title: "", + message: "", + hideCancelButton: true + }); + } + + $.ajax({ + type: "POST", + url: "ajax.php", + data: { + alert_ids: alert_ids, + page: "include/ajax/alert_list.ajax", + alert_validate: 1, + all_groups: , + }, + dataType: "json", + success: function (data) { + $("#menu_tab_frame_view").after(data); + var table = $('#alerts_status_datatable').DataTable({ + ajax: "data.json" + }); + + table.ajax.reload(); + }, + }); + +} + +function show_display_update_action(id_module_action, alert_id, alert_id_agent_module, action_id,id_agent='') { + $.each($('[id^="update_action-div"]'), function(){ + $(this).html(''); + }); + var params = []; + params.push("show_update_action_menu=1"); + params.push("id_agent_module=" + alert_id_agent_module); + params.push("id_module_action=" + id_module_action); + params.push("id_alert=" + alert_id); + params.push("id_action=" + action_id); + params.push("id_agent=" + id_agent); + params.push("page=include/ajax/alert_list.ajax"); + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action="", + success: function (data) { + $('#update_action-div-'+alert_id).html(data); + $('#update_action-div-'+alert_id).dialog ({ + resizable: true, + draggable: true, + title: '', + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + open: function() { + $('#action_select_ajax-'+alert_id).select2(); + }, + onclose: function() { + $('#update_action-div-'+alert_id).html(""); + }, + width: 600, + height: 350, + }) + .show (); + } + }); +} + +function show_add_action(id_alert) { + $("#add_action-div-" + id_alert).hide () + .dialog ({ + resizable: true, + draggable: true, + modal: true, + width: 700, + title: '', + modal: true, + overlay: { + opacity: 0.5, + background: "black" + } + }) + .show (); +} + \ No newline at end of file diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 3a130c1d76..84779427d0 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -94,6 +94,19 @@ if (is_ajax() === true) { } if ($get_agent_module_last_value === true) { + if (is_metaconsole()) { + if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + $server_name = explode(' ', io_safe_output(get_parameter('server_name')))[0]; + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) !== NOERR) { + echo json_encode(false); + // Restore db connection. + metaconsole_restore_db(); + return; + } + } + } + $id_module = (int) get_parameter('id_agent_module'); $id_agent = (int) modules_get_agentmodule_agent((int) $id_module); if (! check_acl_one_of_groups($config['id_user'], agents_get_all_groups_agent($id_agent), 'AR')) { @@ -132,6 +145,11 @@ if (is_ajax() === true) { } } + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + } + echo json_encode($value); return; } diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index b79fbc4115..9bda55e947 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -942,7 +942,12 @@ if (is_ajax()) { if (is_metaconsole() && !$force_local_modules) { if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { + if (empty($server_name)) { + $server_name = explode(' ', io_safe_output($agentName))[0]; + } + $connection = metaconsole_get_connection($server_name); + if ($server_id > 0) { $connection = metaconsole_get_connection_by_id($server_id); }