<%doc> MAC address Report arguments: topn - Show Top N vendors type - Count from one of 'all', 'node', 'infrastructure' MACs <%attr> title => 'MAC Address Report' section => 'Reports' <%args> $topn => 100; $type => 'node' $submit => undef <%init> my $DEBUG = 0; my ($stats, $total); my (@headers, @rows) = (); <%perl> if ( $submit ){ ($stats, $total) = PhysAddr->vendor_count($type); print "
", Dumper($stats), "
" if $DEBUG; @headers = ( 'OUI', 'Vendor', 'Count', '%', ); my @row = (); push( @row, "Total in Database" ); push( @row, "" ); push( @row, "$total" ); push( @row, " " ); push( @rows, \@row ); my $i; foreach my $oui ( sort { $stats->{$b}{total} <=> $stats->{$a}{total} } keys %$stats ){ $i++; my @row = (); my $vendor = $stats->{$oui}{vendor}; my $count = $stats->{$oui}{total}; my $srch = "$oui*"; my $slink = "$oui"; push( @row, $slink, $vendor, $count ); push( @row, sprintf("%02.2f",$count/$total * 100) ); push( @rows, \@row ); last if ( $i == $topn ); } }
MAC Addresses by Vendor (top <% $topn %>)

Top Vendors of type: % my %checked = (node => "", infrastructure => "", all => ""); % $checked{$type} = "SELECTED"; %
% if ( $submit ){ <& /generic/data_table.mhtml, field_headers=>\@headers, data=>\@rows, style=>['', '', 'text-align: right', 'text-align: right'] &> % }