diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index 494bbdd0d2..3a100115e6 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -37,10 +37,11 @@ function createXMLData($agent, $agentModule, $time, $data) { $xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])), io_safe_output($agent['os_version']), $agent['intervalo'], io_safe_output($agent['agent_version']), $time, - io_safe_output($agent['nombre']), $agent['timezone_offset'], + io_safe_output($agent['alias']), $agent['timezone_offset'], io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data); - - if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['nombre']) . '.' . strtotime($time) . '.data', $xml)) { + + + if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['alias']) . '.' . strtotime($time) . '.data', $xml)) { return false; } else { @@ -83,7 +84,7 @@ function mainInsertData() { ui_print_error_message(__('You haven\'t privileges for insert data in the agent.')); } else { - $agent = db_get_row_filter('tagente', array('nombre' => $id_agent)); + $agent = db_get_row_filter('tagente', array('alias' => $id_agent)); $agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); $done = 0; diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 02516b80d1..b3884f3f20 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -30,10 +30,10 @@ if (is_ajax ()) { switch ($config['dbtype']) { case "mysql": case "postgresql": - $filter[] = '(nombre COLLATE utf8_general_ci LIKE "%' . $string . '%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; + $filter[] = '(nombre COLLATE utf8_general_ci LIKE "%' . $string . '%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")'; break; case "oracle": - $filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\'))'; + $filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\') OR upper(alias) LIKE upper(\'%'.$string.'%\'))'; break; } $filter[] = 'id_agente != ' . $id_agent; @@ -150,7 +150,7 @@ $table->style[0] = 'font-weight: bold; width: 150px;'; $table->data = array (); $table->align[2] = 'center'; -html_debug($alias); + if(!$new_agent && $alias != ''){ $table->data[0][0] = __('Agent name') . ui_print_help_tip (__("The agent's name must be the same as the one defined at the console"), true); diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 5b5e60d992..7aab8b8fcd 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -189,12 +189,12 @@ if ($searchFlag) { case "postgresql": $where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente - WHERE t1.nombre LIKE '" . trim($agentName) . "')"; + WHERE t1.alias LIKE '" . trim($agentName) . "')"; break; case "oracle": $where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente - WHERE t1.nombre LIKE '" . trim($agentName) . "')"; + WHERE t1.alias LIKE '" . trim($agentName) . "')"; break; } } @@ -456,8 +456,8 @@ foreach ($simple_alerts as $alert) { if ($alert['disabled']) $data[0] .= ''; - $agent_name = agents_get_name ($id_agent); - $data[0] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[…]', 'display:block;font-size: 7.2pt'); + $alias = db_get_value ("alias","tagente","id_agente",$id_agent); + $data[0] .= $alias; if ($alert['disabled']) $data[0] .= ''; diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 5dadc22038..5c276332e7 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -82,7 +82,7 @@ if ($id) { } } if ($id_agent != 0) { - $text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent); + $text_agent = db_get_value('alias', 'tagente', 'id_agente', $id_agent); if ($text_agent == false) { $text_agent = ''; } diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index 642d0fde04..f69b1ca043 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -370,7 +370,10 @@ foreach ($layoutDatas as $layoutData) { "none", $layoutData['id_metaconsole'], true); } else { - $params['value'] = agents_get_name($layoutData['id_agent']); + $params['print_hidden_input_idagent'] = true; + $params['hidden_input_idagent_name'] = 'id_agent_' . $idLayoutData; + $params['hidden_input_idagent_value'] = $layoutData['id_agent']; + $params['value'] = db_get_value ("alias","tagente","id_agente",$layoutData['id_agent']); } if ($layoutData['id_agent'] == 0 and $layoutData['id_custom_graph'] != 0) { diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 89fd073369..a1e8dd9207 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -350,7 +350,8 @@ switch ($activeTab) { $values['id_agent'] = (int) get_parameter('id_agent_' . $id, 0); } else { - $values['id_agent'] = agents_get_agent_id($agentName); + $agent_id = (int) get_parameter('id_agent_' . $id, 0); + $values['id_agent'] = $agent_id; } $values['id_agente_modulo'] = get_parameter('module_' . $id, 0); $values['id_custom_graph'] = get_parameter('custom_graph_' . $id, 0); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 39ef0d77d7..d9388ed481 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -882,6 +882,21 @@ function agents_get_group_agents ($id_group = 0, $search = false, unset ($search["name"]); } + if (isset ($search["alias"])) { + $name = io_safe_input ($search["alias"]); + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + $filter[] = "alias COLLATE utf8_general_ci LIKE '$name'"; + break; + case "oracle": + $filter[] = "UPPER(alias) LIKE UPPER('$name')"; + break; + } + + unset ($search["alias"]); + } + if (isset($search['status'])) { switch ($search['status']) { case AGENT_STATUS_NORMAL: diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 39ff8f3b02..8860837fed 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -3205,7 +3205,7 @@ function ui_print_agent_autocomplete_input($parameters) { select: function( event, ui ) { - var agent_name = ui.item.name; + var agent_name = ui.item.alias; var agent_id = ui.item.id; var server_name = ""; var server_id = ""; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 1e1a442f87..06711192b7 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -461,7 +461,7 @@ if (is_ajax ()) { if ($agentName != null) { $search = array(); - $search['name'] = io_safe_output($agentName); + $search['alias'] = io_safe_output($agentName); } else $search = false; diff --git a/pandora_console/operation/events/events_marquee.php b/pandora_console/operation/events/events_marquee.php index d75850174b..9fb662eeed 100644 --- a/pandora_console/operation/events/events_marquee.php +++ b/pandora_console/operation/events/events_marquee.php @@ -94,7 +94,7 @@ $result = db_get_all_rows_sql ($sql); foreach ($result as $row) { $agente = ""; if ($row["id_agente"] != 0) { - $agente = db_get_sql ("SELECT nombre + $agente = db_get_sql ("SELECT alias FROM tagente WHERE id_agente = ". $row["id_agente"]); $agente = $agente . " : "; diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index 8aedc9de53..afc57daf45 100755 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -351,7 +351,7 @@ echo ''; $params = array(); $params['show_helptip'] = true; $params['input_name'] = 'agent'; -$params['value'] = agents_get_name ($id_agent); +$params['value'] = db_get_value("alias","tagente","id_agente",$id_agent); $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_value'] = $id_agent; $params['hidden_input_idagent_name'] = 'id_agent';