Changed agent name in tree view, alert status, agent/alert view and agent/modules view.

This commit is contained in:
Daniel Maya 2016-09-26 10:58:42 +02:00
parent 21dd508e53
commit 9a39798f43
9 changed files with 50 additions and 37 deletions

View File

@ -222,9 +222,10 @@ function mainAgentsAlerts() {
}
foreach ($agents as $agent) {
$alias = db_get_row ('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>';
// Name of the agent
echo '<td style="font-weight:bold;">'.$agent['nombre'].'</td>';
echo '<td style="font-weight:bold;">'.$alias['alias'].'</td>';
// Alerts of the agent
$anyfired = false;

View File

@ -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 "<td class='$rowcolor'>
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>" .
ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') .
$alias['alias'] .
"</a></td>";
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, false);

View File

@ -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"];

View File

@ -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;

View File

@ -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 .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent["id_agente"].'">' .
'<b><span style="font-weight:bold;text-transform:uppercase;" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span></b></a>';
if ($agent['disabled']) {
$cellName .= ui_print_help_tip(__('Disabled'), true) . "</em>";

View File

@ -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']] .='<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $alias['nombre']. '">'.$alias["alias"].'</span></a>';
}
else {
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled, false, $console_url, $url_hash);
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $alias['nombre']. '">'.$alias["alias"].'</span></a>';
}
}

View File

@ -369,7 +369,7 @@ var TreeController = {
$content.append($alertImage);
}
$content.append(element.name);
$content.append(element.alias);
break;
case 'module':
// Status image

View File

@ -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;

View File

@ -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] = '<strong><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$row["id_agent"].'">';
$data[1] .= ui_print_truncate_text($row['agent_name'], 'agent_medium', false, true, false, '[&hellip;]', 'font-size:7.5pt;');
$data[1] = '<strong><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$row['id_agent'].'">';
$data[1] .= '<span style="font-weight:bold" title="' . $row['agent_name'] . '">'.$row['alias'].'</span>';
$data[1] .= '</a></strong>';
}