diff --git a/lib/App/Netdisco/Util/DNS.pm b/lib/App/Netdisco/Util/DNS.pm index afd13fb5..23e0ef2b 100644 --- a/lib/App/Netdisco/Util/DNS.pm +++ b/lib/App/Netdisco/Util/DNS.pm @@ -111,8 +111,8 @@ This method uses a fully asynchronous and high-performance pure-perl stub resolver C. Given a reference to an array of hashes will resolve the C or C -address in the C or C key of each hash into its hostname which -will be inserted in the C key of the hash. +address in the C, C, or C key of each hash into its +hostname which will be inserted in the C key of the hash. Returns the supplied reference to an array of hashes with dns values for addresses which resolved. @@ -128,7 +128,7 @@ sub hostnames_resolve_async { $done->begin( sub { shift->send } ); IP: foreach my $hash_ref (@$ips) { - my $ip = $hash_ref->{'ip'} || $hash_ref->{'alias'}; + my $ip = $hash_ref->{'ip'} || $hash_ref->{'alias'} || $hash_ref->{'device'}; next IP if App::Netdisco::Util::Permission::check_acl_no($ip, $skip); # check /etc/hosts file and short-circuit if found diff --git a/lib/App/Netdisco/Web/Plugin/AdminTask/TimedOutDevices.pm b/lib/App/Netdisco/Web/Plugin/AdminTask/TimedOutDevices.pm index f8184dd2..c644eead 100644 --- a/lib/App/Netdisco/Web/Plugin/AdminTask/TimedOutDevices.pm +++ b/lib/App/Netdisco/Web/Plugin/AdminTask/TimedOutDevices.pm @@ -6,6 +6,7 @@ use Dancer::Plugin::DBIC; use Dancer::Plugin::Auth::Extensible; use App::Netdisco::Web::Plugin; +use App::Netdisco::Util::DNS 'hostnames_resolve_async'; register_admin_task({ tag => 'timedoutdevices', @@ -13,15 +14,17 @@ register_admin_task({ }); ajax '/ajax/content/admin/timedoutdevices' => require_role admin => sub { - my @results = schema('netdisco')->resultset('DeviceSkip')->search({ + my @set = schema('netdisco')->resultset('DeviceSkip')->search({ deferrals => { '>' => 0 } - },{ order_by => + },{ rows => 30, order_by => [{ -desc => 'deferrals' }, { -asc => [qw/device backend/] }] })->hri->all; + my $results = hostnames_resolve_async(\@set); + content_type('text/html'); template 'ajax/admintask/timedoutdevices.tt', { - results => \@results, + results => $results }, { layout => undef }; }; diff --git a/share/views/ajax/admintask/timedoutdevices.tt b/share/views/ajax/admintask/timedoutdevices.tt index f7ac0a23..77b8160b 100644 --- a/share/views/ajax/admintask/timedoutdevices.tt +++ b/share/views/ajax/admintask/timedoutdevices.tt @@ -6,6 +6,7 @@ Poller Host Device + Device DNS Failed Connections @@ -14,7 +15,8 @@ [% row.backend | html_entity %] [% row.device | html_entity %] + href="[% uri_for('/search') %]?tab=node&q=[% row.device | uri %]">[% row.device | html_entity %] + [% row.dns | html_entity %] [% row.deferrals | html_entity %] [% END %]