diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index f7644e8919..2a798c527c 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -2311,27 +2311,36 @@ function agents_get_agent_with_ip($ip_address)
/**
* Get all IP addresses of an agent
*
- * @param int Agent id
+ * @param int Agent id
+ * @param bool Order by id
*
* @return array Array with the IP address of the given agent or an empty array.
*/
-function agents_get_addresses($id_agent)
-{
+function agents_get_addresses(
+ $id_agent,
+ $order_by_id=false
+) {
+ $order_clause = ($order_by_id === true) ? 'ORDER BY taddress.id_a' : '';
+
if (is_array($id_agent)) {
$sql = sprintf(
'SELECT ip
FROM taddress_agent, taddress
WHERE taddress_agent.id_a = taddress.id_a
- AND id_agent IN (%s)',
- implode(',', $id_agent)
+ AND id_agent IN (%s)
+ %s',
+ implode(',', $id_agent),
+ $order_clause
);
} else {
$sql = sprintf(
'SELECT ip
FROM taddress_agent, taddress
WHERE taddress_agent.id_a = taddress.id_a
- AND id_agent = %d',
- $id_agent
+ AND id_agent = %d
+ %s',
+ $id_agent,
+ $order_clause
);
}
diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php
index 6a1fa988d3..0cf348ab50 100755
--- a/pandora_console/operation/agentes/estado_generalagente.php
+++ b/pandora_console/operation/agentes/estado_generalagente.php
@@ -142,7 +142,7 @@ if (empty($agent['os_version']) !== true) {
$table_status->data['agent_os_version'][1] = $os_agent_text;
}
-$addresses = agents_get_addresses($id_agente);
+$addresses = agents_get_addresses($id_agente, true);
$address = agents_get_address($id_agente);
foreach ($addresses as $k => $add) {
@@ -154,8 +154,26 @@ foreach ($addresses as $k => $add) {
if (empty($address) === false) {
$address_text = ''.$address.'';
if (!empty($addresses) === true) {
- foreach ($addresses as $sec_address) {
- $address_text .= '
'.$sec_address.'';
+ if (count($addresses) > 3) {
+ $address_text .= '  '.html_print_image(
+ 'images/sort_down_black.png',
+ true,
+ ['alt' => 'down']
+ ).'';
+ $address_text .= '