better interface naming for Ubiquiti
This commit is contained in:
@@ -207,6 +207,46 @@ sub mac {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub interfaces {
|
||||||
|
my $netgear = shift;
|
||||||
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $interfaces = $netgear->i_index($partial) || {};
|
||||||
|
my $i_descr = $netgear->i_description($partial) || {};
|
||||||
|
my $return = {};
|
||||||
|
|
||||||
|
foreach my $iid ( keys %$i_descr ) {
|
||||||
|
# Slot: 0 Port: 4 Gigabit - Level
|
||||||
|
if ($i_descr->{$iid} =~ m/([0-9]+)[^0-9]+([0-9]+)/) {
|
||||||
|
$return->{$iid} = $1 .'/'. $2;
|
||||||
|
}
|
||||||
|
# Link Aggregate 4
|
||||||
|
if ($i_descr->{$iid} =~ m/Link Aggregate (\d+)/) {
|
||||||
|
$return->{$iid} = '3/'. $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_ignore {
|
||||||
|
my $l2 = shift;
|
||||||
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $interfaces = $l2->interfaces($partial) || {};
|
||||||
|
my $i_descr = $l2->i_description($partial) || {};
|
||||||
|
|
||||||
|
my %i_ignore;
|
||||||
|
foreach my $if ( keys %$interfaces ) {
|
||||||
|
|
||||||
|
# CPU Interface
|
||||||
|
if ( $i_descr->{$if} =~ /CPU Interface/i ) {
|
||||||
|
$i_ignore{$if}++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return \%i_ignore;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ sub uptime {
|
|||||||
# concatentate ifDesc and ifIndex.
|
# concatentate ifDesc and ifIndex.
|
||||||
# (code from SNMP/Info/Layer2/Netgear.pm)
|
# (code from SNMP/Info/Layer2/Netgear.pm)
|
||||||
sub interfaces {
|
sub interfaces {
|
||||||
my $netgear = shift;
|
my $netsnmp = shift;
|
||||||
my $partial = shift;
|
my $partial = shift;
|
||||||
|
|
||||||
my $interfaces = $netgear->i_index($partial) || {};
|
my $interfaces = $netsnmp->i_index($partial) || {};
|
||||||
my $i_descr = $netgear->i_description($partial) || {};
|
my $i_descr = $netsnmp->i_description($partial) || {};
|
||||||
my $i_name = $netgear->i_name($partial);
|
my $i_name = $netsnmp->i_name($partial);
|
||||||
my $i_isset = ();
|
my $i_isset = ();
|
||||||
# Replace the description with the ifName field, if set
|
# Replace the description with the ifName field, if set
|
||||||
foreach my $iid ( keys %$i_name ) {
|
foreach my $iid ( keys %$i_name ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user