a report to show SNMP failures

This commit is contained in:
Oliver Gorwits
2017-05-23 20:09:05 +01:00
parent 3d136a54de
commit d8d082b30e
4 changed files with 60 additions and 1 deletions

View File

@@ -41,7 +41,9 @@ sub _getsome {
my $jobs = schema('netdisco')->resultset('Admin');
my $rs = $jobs->search({
status => 'queued',
device => { '-not_in' => $jobs->skipped->columns('device')->as_query },
device => { '-not_in' =>
$jobs->skipped($fqdn, setting('workers')->{'max_deferrals'})
->columns('device')->as_query },
%$where,
}, { order_by => 'random()', rows => $num_slots });

View File

@@ -0,0 +1,26 @@
package App::Netdisco::Web::Plugin::AdminTask::TimedOutDevices;
use Dancer ':syntax';
use Dancer::Plugin::Ajax;
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::Web::Plugin;
register_admin_task({
tag => 'timedoutdevices',
label => 'SNMP Connect Failures',
});
ajax '/ajax/content/admin/timedoutdevices' => require_role admin => sub {
my @results = schema('netdisco')->resultset('DeviceSkip')->search({
deferrals => { '>=' => setting('workers')->{'max_deferrals'} }
},{ order_by => { -asc => [qw/backend device/] } })->hri->all;
content_type('text/html');
template 'ajax/admintask/timedoutdevices.tt', {
results => \@results,
}, { layout => undef };
};
true;

View File

@@ -71,6 +71,7 @@ web_plugins:
- AdminTask::SlowDevices
- AdminTask::UndiscoveredNeighbors
- AdminTask::OrphanedDevices
- AdminTask::TimedOutDevices
- AdminTask::UserLog
- AdminTask::Users
- Search::Device
@@ -205,6 +206,7 @@ workers:
tasks: 'AUTO * 2'
sleep_time: 1
min_runtime: 0
max_deferrals: 10
queue: PostgreSQL
dns:

View File

@@ -0,0 +1,29 @@
[% IF NOT results.size %]
<div class="span4 alert alert-info">No significant events to report.</div>
[% ELSE %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Poller Host</th>
<th class="nd_center-cell">Device</th>
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<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>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<script>
$(document).ready(function() {
$('#data-table').dataTable({
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>