diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index 5e8b00ee42..47efc67289 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -222,9 +222,10 @@ function mainAgentsAlerts() { } foreach ($agents as $agent) { + $alias = db_get_row ('tagente', 'id_agente', $agent['id_agente']); echo ''; // Name of the agent - echo ''.$agent['nombre'].''; + echo ''.$alias['alias'].''; // Alerts of the agent $anyfired = false; diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 5c16e6b039..ae629a0f3e 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -263,6 +263,10 @@ function mainAgentsModules() { foreach ($agents as $agent) { // Get stats for this group $agent_status = agents_get_status($agent['id_agente']); + $alias = db_get_row ("tagente", "id_agente", $agent['id_agente']); + if (empty($alias['alias'])){ + $alias['alias'] = $agent['nombre']; + } switch($agent_status) { case 4: // Alert fired status @@ -288,7 +292,7 @@ function mainAgentsModules() { echo " " . - ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') . + $alias['alias'] . ""; $agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, false); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index a20e82e6d1..51ba271b8c 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -73,7 +73,7 @@ $campo_3 = ""; $maximo = 0; $minimo = 0; $nombre_agente = ""; -$alias = ""; +$alias = get_parameter('alias', ''); $direccion_agente = get_parameter('direccion', ''); $direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = io_safe_input($direccion_agente); @@ -800,9 +800,11 @@ if ($id_agente) { $intervalo = $agent["intervalo"]; // Define interval in seconds $nombre_agente = $agent["nombre"]; - $alias = $agent["alias"]; - if(empty ($alias)){ - $alias = $nombre_agente; + if(empty($alias)){ + $alias = $agent["alias"]; + if(empty($alias)){ + $alias = $nombre_agente; + } } $direccion_agente = $agent["direccion"]; $grupo = $agent["id_grupo"]; diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index a1467e6992..eb60f09b65 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -234,7 +234,7 @@ class Tree { // Agent name filter $agent_search_filter = ""; if (!empty($this->filter['searchAgent'])) { - $agent_search_filter = " AND ta.nombre LIKE '%".$this->filter['searchAgent']."%' "; + $agent_search_filter = " AND ta.nombre LIKE '%".$this->filter['searchAgent']."%' OR ta.alias LIKE '%".$this->filter['searchAgent']."%'"; } // Agent status filter @@ -409,15 +409,15 @@ class Tree { } else { if (! is_metaconsole() || $this->strictACL) { - $columns = 'ta.id_agente AS id, ta.nombre AS name, + $columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $group_by_fields = 'ta.id_agente, ta.nombre, + $group_by_fields = 'ta.id_agente, ta.nombre, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $order_fields = 'ta.nombre ASC, ta.id_agente ASC'; + $order_fields = 'ta.alias ASC, ta.id_agente ASC'; $sql = "SELECT $columns FROM tagente ta @@ -435,11 +435,11 @@ class Tree { ORDER BY $order_fields"; } else { - $columns = 'ta.id_tagente AS id, ta.nombre AS name, + $columns = 'ta.id_tagente AS id, ta.nombre AS name, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet, id_tmetaconsole_setup AS server_id'; - $order_fields = 'ta.nombre ASC, ta.id_tagente ASC'; + $order_fields = 'ta.alias ASC, ta.id_tagente ASC'; $sql = "SELECT $columns FROM tmetaconsole_agent ta @@ -593,15 +593,15 @@ class Tree { } } else { - $columns = 'ta.id_agente AS id, ta.nombre AS name, + $columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $group_by_fields = 'ta.id_agente, ta.nombre, + $group_by_fields = 'ta.id_agente, ta.nombre, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $order_fields = 'ta.nombre ASC, ta.id_agente ASC'; + $order_fields = 'ta.alias ASC, ta.id_agente ASC'; $sql = "SELECT $columns FROM tagente ta @@ -716,15 +716,15 @@ class Tree { } } else { - $columns = 'ta.id_agente AS id, ta.nombre AS name, + $columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $group_by_fields = 'ta.id_agente, ta.nombre, + $group_by_fields = 'ta.id_agente, ta.nombre, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $order_fields = 'ta.nombre ASC, ta.id_agente ASC'; + $order_fields = 'ta.alias ASC, ta.id_agente ASC'; $sql = "SELECT $columns FROM tagente ta @@ -845,15 +845,15 @@ class Tree { } } else { - $columns = 'ta.id_agente AS id, ta.nombre AS name, + $columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $group_by_fields = 'ta.id_agente, ta.nombre, + $group_by_fields = 'ta.id_agente, ta.nombre, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $order_fields = 'ta.nombre ASC, ta.id_agente ASC'; + $order_fields = 'ta.alias ASC, ta.id_agente ASC'; $sql = "SELECT $columns FROM tagente ta @@ -976,15 +976,15 @@ class Tree { } } else { - $columns = 'ta.id_agente AS id, ta.nombre AS name, + $columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $group_by_fields = 'ta.id_agente, ta.nombre, + $group_by_fields = 'ta.id_agente, ta.nombre, ta.alias, ta.fired_count, ta.normal_count, ta.warning_count, ta.critical_count, ta.unknown_count, ta.notinit_count, ta.total_count, ta.quiet'; - $order_fields = 'ta.nombre ASC, ta.id_agente ASC'; + $order_fields = 'ta.alias ASC, ta.id_agente ASC'; $symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~'; $name = $rootID; diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 92ac82caa7..0dfa88890a 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -385,8 +385,9 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals else { $cellName = ''; } - - $cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, can_user_access_node ()); + + $cellName .= '' . + ''.$agent["alias"].''; if ($agent['disabled']) { $cellName .= ui_print_help_tip(__('Disabled'), true) . ""; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 36764908e0..39ff8f3b02 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -787,6 +787,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f // Get agent id $id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']); + $alias = db_get_row ('tagente', 'id_agente', $id_agent); $template = alerts_get_alert_template ($alert['id_alert_template']); $description = io_safe_output($template['name']); @@ -846,10 +847,10 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f } else { if ($agent_style !== false) { - $data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled . " $agent_style", false, $console_url, $url_hash, $agent_name); + $data[$index['agent_name']] .=' '.$alias["alias"].''; } else { - $data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled, false, $console_url, $url_hash); + $data[$index['agent_name']] .= ' '.$alias["alias"].''; } } diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index ef4b10bd1f..135a1e86ee 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -369,7 +369,7 @@ var TreeController = { $content.append($alertImage); } - $content.append(element.name); + $content.append(element.alias); break; case 'module': // Status image diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 2172bd555b..04a7c03af1 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -179,7 +179,7 @@ if ($free_search != '') { WHERE id_agente IN ( SELECT id_agente FROM tagente - WHERE nombre LIKE "%' . $free_search . '%"))' . + WHERE nombre LIKE "%' . $free_search . '%") OR alias LIKE "%' . $free_search . '%")' . ')'; break; @@ -214,7 +214,7 @@ if ($free_search != '') { WHERE id_agente IN ( SELECT id_agente FROM tagente - WHERE nombre LIKE \'%' . $free_search . '%\'))' . + WHERE nombre LIKE \'%' . $free_search . '%\' OR alias LIKE \'%' . $free_search . '%\'))' . ')'; break; diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index ef80fd1938..870dfe314b 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -141,8 +141,9 @@ if ($ag_modulename != '') { if ($ag_freestring != '') { $sql_conditions .= sprintf (' AND (tagente.nombre LIKE \'%%%s%%\' OR tagente_modulo.nombre LIKE \'%%%s%%\' - OR tagente_modulo.descripcion LIKE \'%%%s%%\')', - $ag_freestring, $ag_freestring, $ag_freestring); + OR tagente_modulo.descripcion LIKE \'%%%s%%\' + OR tagente.alias LIKE \'%%%s%%\')', + $ag_freestring, $ag_freestring, $ag_freestring, $ag_freestring); } // Status selector @@ -552,7 +553,8 @@ switch ($config['dbtype']) { AS tags, tagente_modulo.id_agente_modulo, tagente.intervalo AS agent_interval, - tagente.nombre AS agent_name, + tagente.nombre AS agent_name, + tagente.alias AS alias, tagente_modulo.nombre AS module_name, tagente_modulo.history_data, tagente_modulo.flag AS flag, @@ -600,6 +602,7 @@ switch ($config['dbtype']) { tagente_modulo.id_agente_modulo, tagente.intervalo AS agent_interval, tagente.nombre AS agent_name, + tagente.alias AS alias, tagente_modulo.nombre AS module_name, tagente_modulo.history_data, tagente_modulo.flag AS flag, @@ -641,7 +644,8 @@ switch ($config['dbtype']) { AS tags, tagente_modulo.id_agente_modulo, tagente.intervalo AS agent_interval, - tagente.nombre AS agent_name, + tagente.nombre AS agent_name, + tagente.alias AS alias, tagente_modulo.nombre AS module_name, tagente_modulo.history_data, tagente_modulo.flag AS flag, @@ -901,8 +905,8 @@ foreach ($result as $row) { } } else { - $data[1] = ''; - $data[1] .= ui_print_truncate_text($row['agent_name'], 'agent_medium', false, true, false, '[…]', 'font-size:7.5pt;'); + $data[1] = ''; + $data[1] .= ''.$row['alias'].''; $data[1] .= ''; }