add DNS to SNMP Connect Failures report

This commit is contained in:
Oliver Gorwits
2017-05-30 21:01:35 +01:00
parent a553a86f51
commit 3aa34f12dc
3 changed files with 12 additions and 7 deletions

View File

@@ -111,8 +111,8 @@ This method uses a fully asynchronous and high-performance pure-perl stub
resolver C<AnyEvent::DNS>.
Given a reference to an array of hashes will resolve the C<IPv4> or C<IPv6>
address in the C<ip> or C<alias> key of each hash into its hostname which
will be inserted in the C<dns> key of the hash.
address in the C<ip>, C<alias>, or C<device> key of each hash into its
hostname which will be inserted in the C<dns> 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

View File

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

View File

@@ -6,6 +6,7 @@
<tr>
<th class="nd_center-cell">Poller Host</th>
<th class="nd_center-cell">Device</th>
<th class="nd_center-cell">Device DNS</th>
<th class="nd_center-cell">Failed Connections</th>
</tr>
</thead>
@@ -14,7 +15,8 @@
<tr>
<td class="nd_center-cell">[% row.backend | html_entity %]</td>
<td class="nd_center-cell"><a class="nd_linkcell"
href="[% uri_for('/device') %]?q=[% row.device | uri %]">[% row.device | html_entity %]</a></td>
href="[% uri_for('/search') %]?tab=node&q=[% row.device | uri %]">[% row.device | html_entity %]</a></td>
<td class="nd_center-cell">[% row.dns | html_entity %]</td>
<td class="nd_center-cell">[% row.deferrals | html_entity %]</td>
</tr>
[% END %]