Merge branch '149-SNMP-console-doesnt-show-agent-aliases' into 'develop'

Modified SNMP Console to prefer agent aliases as SNMP agent if registered.  #149

Closes #149

See merge request !489
This commit is contained in:
nramon 2017-06-28 08:37:29 +02:00
commit d7b45cb027

View File

@ -194,7 +194,7 @@ $severities = get_priorities ();
$alerted = array (__('Not fired'), __('Fired')); $alerted = array (__('Not fired'), __('Fired'));
foreach ($all_traps as $trap) { foreach ($all_traps as $trap) {
$agent = agents_get_agent_with_ip ($trap['source']); $agent = agents_get_agent_with_ip ($trap['source']);
$agents[$trap["source"]] = $agent !== false ? $agent["nombre"] : $trap["source"]; $agents[$trap["source"]] = $agent !== false ? ($agent["alias"] ? $agent["alias"] : $agent["nombre"]) : $trap["source"];
$oid = enterprise_hook ('get_oid', array ($trap)); $oid = enterprise_hook ('get_oid', array ($trap));
if ($oid === ENTERPRISE_NOT_HOOK) { if ($oid === ENTERPRISE_NOT_HOOK) {
$oid = $trap["oid"]; $oid = $trap["oid"];
@ -774,7 +774,7 @@ if ($traps !== false) {
continue; continue;
} }
$data[1] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'" title="'.__('View agent details').'">'; $data[1] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'" title="'.__('View agent details').'">';
$data[1] .= '<strong>'.$agent["nombre"].ui_print_help_tip($trap['source'], true, "images/tip-blanco.png");'</strong></a>'; $data[1] .= '<strong>'.($agent["alias"] ? $agent["alias"] : $agent["nombre"]).ui_print_help_tip($trap['source'], true, "images/tip-blanco.png");'</strong></a>';
} }
//OID //OID
@ -1156,4 +1156,4 @@ ui_include_time_picker();
} }
} }
</script> </script>