diff --git a/Netdisco/Changes b/Netdisco/Changes index 1dedf9c2..326a78d7 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -4,6 +4,7 @@ * Can now set untagged VLAN on trunking and non-trunking ports * Add user activity log to frontend admin menu + * Add Poller Performance admin report [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/PollerPerformance.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/PollerPerformance.pm new file mode 100644 index 00000000..f5e941a7 --- /dev/null +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/PollerPerformance.pm @@ -0,0 +1,43 @@ +package App::Netdisco::Web::Plugin::AdminTask::PollerPerformance; + +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 => 'performance', + label => 'Poller Performance', +}); + +ajax '/ajax/content/admin/performance' => require_role admin => sub { + my $set = schema('netdisco')->resultset('Admin') + ->search({ + action => { -in => [qw/discover macsuck arpnip/] }, + }, { + columns => [ + 'action', 'entered', + { entered_stamp => \"to_char(entered, 'YYYY-MM-DD HH24:MI:SS')" }, + ], + select => [ + { count => 'device', -as => 'number' }, + { min => 'started', -as => 'start' }, + { max => 'finished', -as => 'end' }, + \"justify_interval(extract(epoch from (max(finished) - min(started))) * interval '1 second') AS elapsed", + ], + as => [qw/ number start end elapsed /], + group_by => [qw/ action entered /], + having => \'count(device) > 1', + order_by => { -desc => [qw/ entered elapsed /] }, + rows => 50, + }); + + content_type('text/html'); + template 'ajax/admintask/performance.tt', { + results => $set, + }, { layout => undef }; +}; + +true; diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index cb85e29a..57626670 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -41,11 +41,12 @@ web_plugins: - Report::DuplexMismatch - Report::SsidInventory - Report::VlanInventory + - AdminTask::JobQueue + - AdminTask::PollerPerformance - AdminTask::PseudoDevice - AdminTask::Topology - - AdminTask::JobQueue - - AdminTask::Users - AdminTask::UserLog + - AdminTask::Users - Search::Device - Search::Node - Search::VLAN diff --git a/Netdisco/share/views/ajax/admintask/performance.tt b/Netdisco/share/views/ajax/admintask/performance.tt new file mode 100644 index 00000000..a9f47755 --- /dev/null +++ b/Netdisco/share/views/ajax/admintask/performance.tt @@ -0,0 +1,29 @@ +[% IF results.count == 0 %] +
The aren't enough jobs to report.
+[% ELSE %] + + + + + + + + + + + + + [% WHILE (row = results.next) %] + + + + + + + + + [% END %] + +
ActionNumber of DevicesQueued AtStartedFinishedTime Elapsed
[% row.action.ucfirst | html_entity %][% row.get_column('number') | html_entity %][% row.get_column('entered_stamp') | html_entity %][% row.get_column('start') | html_entity %][% row.get_column('end') | html_entity %][% row.get_column('elapsed') | html_entity %]
+[% END %] +