add About page (jeneric) with system stats
Squashed commit of the following: commit f53b3778de8dc529c0d161a9339ad14e21294802 Author: Eric A. Miller <emiller@cpan.org> Date: Sun Sep 8 21:05:39 2013 -0400 remove header from statistics table commit fa69b1b5900444ca5320502d8c22ecd7ee21df45 Author: Eric A. Miller <emiller@cpan.org> Date: Sun Sep 8 21:00:02 2013 -0400 about page - software and statistics
This commit is contained in:
@@ -19,6 +19,7 @@ use App::Netdisco::Web::Report;
|
||||
use App::Netdisco::Web::AdminTask;
|
||||
use App::Netdisco::Web::TypeAhead;
|
||||
use App::Netdisco::Web::PortControl;
|
||||
use App::Netdisco::Web::About;
|
||||
|
||||
sub _load_web_plugins {
|
||||
my $plugin_list = shift;
|
||||
|
||||
81
Netdisco/lib/App/Netdisco/Web/About.pm
Normal file
81
Netdisco/lib/App/Netdisco/Web/About.pm
Normal file
@@ -0,0 +1,81 @@
|
||||
package App::Netdisco::Web::About;
|
||||
|
||||
use Dancer ':syntax';
|
||||
use Dancer::Plugin::DBIC;
|
||||
use Dancer::Plugin::Auth::Extensible;
|
||||
|
||||
get '/about' => require_login sub {
|
||||
|
||||
my $time1 = time;
|
||||
my $schema = schema('netdisco');
|
||||
my $devices = $schema->resultset('Device')->search(
|
||||
{},
|
||||
{ select => [ { version => '' } ],
|
||||
as => [qw/ version /],
|
||||
}
|
||||
);
|
||||
|
||||
my $device_count = $devices->count;
|
||||
my $device_port_count = $schema->resultset('DevicePort')->count;
|
||||
|
||||
my $device_ip_count = $schema->resultset('DeviceIp')
|
||||
->search( undef, { columns => [qw/ alias /] } )->count;
|
||||
|
||||
my $nodes = $schema->resultset('Node')->search(
|
||||
{},
|
||||
{ columns => [qw/mac/],
|
||||
distinct => 1
|
||||
}
|
||||
);
|
||||
|
||||
my $node_count = $nodes->count;
|
||||
my $node_table_count = $schema->resultset('Node')->count;
|
||||
|
||||
my $nodes_ips = $schema->resultset('NodeIp')->search(
|
||||
{},
|
||||
{ columns => [qw/ip/],
|
||||
distinct => 1
|
||||
}
|
||||
);
|
||||
my $ip_count = $nodes_ips->count;
|
||||
my $ip_table_count
|
||||
= $schema->resultset('NodeIp')->search( {}, { columns => [qw/ip/] } )
|
||||
->count;
|
||||
my $device_links = $schema->resultset('DevicePort')
|
||||
->search( { 'remote_ip' => { '!=', undef } } )->count;
|
||||
my $schema_version = $schema->get_db_version;
|
||||
my $target_version = $schema->schema_version;
|
||||
|
||||
my $time2 = time;
|
||||
my $process_time = $time2 - $time1;
|
||||
|
||||
my $disco_ver = $App::Netdisco::VERSION;
|
||||
my $dancer_ver = $Dancer::VERSION;
|
||||
my $perl_ver = sprintf( "v%vd", $^V );
|
||||
my $db_version = $devices->next->get_column('version');
|
||||
my $dbi_ver = $DBI::VERSION;
|
||||
my $dbdpg_ver = $DBD::Pg::VERSION;
|
||||
|
||||
var( nav => 'about' );
|
||||
|
||||
template 'about',
|
||||
{
|
||||
device_count => $device_count,
|
||||
device_ip_count => $device_ip_count,
|
||||
device_links => $device_links,
|
||||
device_port_count => $device_port_count,
|
||||
ip_count => $ip_count,
|
||||
ip_table_count => $ip_table_count,
|
||||
node_count => $node_count,
|
||||
node_table_count => $node_table_count,
|
||||
process_time => $process_time,
|
||||
disco_ver => $disco_ver,
|
||||
dancer_ver => $dancer_ver,
|
||||
perl_ver => $perl_ver,
|
||||
db_version => $db_version,
|
||||
dbi_ver => $dbi_ver,
|
||||
dbdpg_ver => $dbdpg_ver,
|
||||
};
|
||||
};
|
||||
|
||||
true;
|
||||
Reference in New Issue
Block a user