+ MibDir addition to allow for specifying mib dirs.
* _global() change so that failed data is cached and not
attempted to be retrieved.
This includes NOSUCH* type returns
+ All of jerneric's kick-ass Nortel additions and typo fixes.
This commit is contained in:
181
Info.pm
181
Info.pm
@@ -1,5 +1,4 @@
|
|||||||
# SNMP::Info - Max Baker
|
# SNMP::Info - Max Baker
|
||||||
# $Id$
|
|
||||||
#
|
#
|
||||||
# Portions Copyright (c) 2003,2004 Max Baker
|
# Portions Copyright (c) 2003,2004 Max Baker
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@@ -9,7 +8,7 @@
|
|||||||
# See COPYRIGHT at bottom
|
# See COPYRIGHT at bottom
|
||||||
|
|
||||||
package SNMP::Info;
|
package SNMP::Info;
|
||||||
$VERSION = 0.8;
|
$VERSION = 0.9;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use Exporter;
|
use Exporter;
|
||||||
@@ -112,7 +111,7 @@ setting for that port with two methods -- interfaces() and i_duplex().
|
|||||||
The information may be coming from any number of MIB files and is very vendor specific.
|
The information may be coming from any number of MIB files and is very vendor specific.
|
||||||
SNMP::Info provides you a common method for all supported devices.
|
SNMP::Info provides you a common method for all supported devices.
|
||||||
|
|
||||||
Adding support for your own device is easy, and takes little much SNMP knowledge.
|
Adding support for your own device is easy, and takes little SNMP knowledge.
|
||||||
|
|
||||||
The module is not limited to network devices. Any MIB or device can be given an objected oriented
|
The module is not limited to network devices. Any MIB or device can be given an objected oriented
|
||||||
front-end by making a module that consists of a couple hashes. See EXTENDING SNMP::INFO.
|
front-end by making a module that consists of a couple hashes. See EXTENDING SNMP::INFO.
|
||||||
@@ -299,6 +298,25 @@ ETHERLIKE-MIB (RFC1398) - Some Layer3 devices implement this MIB, as well as som
|
|||||||
|
|
||||||
MAU-MIB (RFC2668). Some Layer2 devices use this for extended Ethernet (Media Access Unit) interface information.
|
MAU-MIB (RFC2668). Some Layer2 devices use this for extended Ethernet (Media Access Unit) interface information.
|
||||||
|
|
||||||
|
=item SNMP::Info::NortelStack
|
||||||
|
|
||||||
|
S5-AGENT-MIB, S5-CHASSIS-MIB.
|
||||||
|
|
||||||
|
See SNMP::Info::NortelStack for where to get MIBs required.
|
||||||
|
|
||||||
|
=item SNMP::Info::RapidCity
|
||||||
|
|
||||||
|
RAPID-CITY. Inhertited by Nortel Networks switches for duplex and VLAN information.
|
||||||
|
|
||||||
|
See SNMP::Info::RapidCity for where to get MIBs required.
|
||||||
|
|
||||||
|
=item SNMP::Info::SONMP
|
||||||
|
|
||||||
|
SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB. Provides translation from Nortel Networks Topology
|
||||||
|
Table information to CDP. Inherited by Nortel/Bay switches and hubs.
|
||||||
|
|
||||||
|
See SNMP::Info::SONMP for where to get MIBs required.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head3 Device Subclasses
|
=head3 Device Subclasses
|
||||||
@@ -330,6 +348,13 @@ Requires ASANTE-HUB1012-MIB
|
|||||||
|
|
||||||
See SNMP::Info::Layer1::Asante for where to get MIBs required.
|
See SNMP::Info::Layer1::Asante for where to get MIBs required.
|
||||||
|
|
||||||
|
=item SNMP::Info::Layer1::Bayhub
|
||||||
|
|
||||||
|
Subclass for Nortel/Bay hubs. This includes System 5000, 100 series,
|
||||||
|
200 series, and probably more.
|
||||||
|
|
||||||
|
See SNMP::Info::Layer1::Bayhub for where to get MIBs required.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=item SNMP::Info::Layer2
|
=item SNMP::Info::Layer2
|
||||||
@@ -347,14 +372,13 @@ Layer3::Aironet for Aironet devices that don't run IOS.
|
|||||||
|
|
||||||
Allied Telesys switches.
|
Allied Telesys switches.
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::Bay
|
=item SNMP::Info::Layer2::Baystack
|
||||||
|
|
||||||
Bay Networks BayStack switch Support. Provides translation from Bay Network Topology Table
|
Subclass for Nortel/Bay Baystack switches. This includes 303, 304, 350, 380,
|
||||||
information to CDP.
|
410, 420, 425, 450, 460, 470, 5510, 5520, Business Policy Switch (BPS) and
|
||||||
|
probably others.
|
||||||
|
|
||||||
Requires SYNOPTICS-ROOT-MIB and S5-ETH-MULTISEG-TOPOLOGY-MIB
|
See SNMP::Info::Layer2::Baystack for where to get MIBs required.
|
||||||
|
|
||||||
See SNMP::Info::Bay for where to get MIBs required.
|
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::C1900
|
=item SNMP::Info::Layer2::C1900
|
||||||
|
|
||||||
@@ -370,14 +394,30 @@ Subclass for Cisco Catalyst switches running CatOS. These switches usually
|
|||||||
report a model number that starts with C<wsc>. Note that this class
|
report a model number that starts with C<wsc>. Note that this class
|
||||||
does not support everything that has the name Catalyst.
|
does not support everything that has the name Catalyst.
|
||||||
|
|
||||||
|
=item SNMP::Info::Layer2::Centillion
|
||||||
|
|
||||||
|
Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
|
||||||
|
|
||||||
|
See SNMP::Info::Layer2::Centillion for where to get MIBs required.
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::HP
|
=item SNMP::Info::Layer2::HP
|
||||||
|
|
||||||
Subclass for HP Procurve Swithces
|
Subclass for HP Procurve Switches
|
||||||
|
|
||||||
Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
|
Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
|
||||||
|
|
||||||
See SNMP::Info::Layer2::HP for more info.
|
See SNMP::Info::Layer2::HP for more info.
|
||||||
|
|
||||||
|
=item SNMP::Info::Layer2::NAP222x
|
||||||
|
|
||||||
|
Subclass for Nortel Networks' 222x series wireless access points.
|
||||||
|
|
||||||
|
See SNMP::Info::Layer2::NAP222x for where to get MIBs required.
|
||||||
|
|
||||||
|
=item SNMP::Info::Layer2::Orinoco
|
||||||
|
|
||||||
|
Subclass for Orinoco wireless access points.
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::ZyXEL_DSLAM
|
=item SNMP::Info::Layer2::ZyXEL_DSLAM
|
||||||
|
|
||||||
Zyxel DSLAMs. Need I say more?
|
Zyxel DSLAMs. Need I say more?
|
||||||
@@ -399,13 +439,18 @@ MIBs for these devices now included in v2.tar.gz available from ftp.cisco.com.
|
|||||||
|
|
||||||
Note Layer2::Aironet
|
Note Layer2::Aironet
|
||||||
|
|
||||||
=item SNMP::Info::Layer3::Foundry
|
=item SNMP::Info::Layer3::AlteonAD
|
||||||
|
|
||||||
Subclass for older Foundry Network devices. Outdated, but being updated for newer devices.
|
Subclass for Nortel Networks' Alteon Ace Director series L2-7 switches.
|
||||||
|
|
||||||
Requires FOUNDRY-SN-ROOT-MIB.
|
See SNMP::Info::Layer3::AlteonAD for where to get MIBs required.
|
||||||
|
|
||||||
See SNMP::Info::Layer3::Foundry for more info.
|
=item SNMP::Info::Layer3::BayRS
|
||||||
|
|
||||||
|
Subclass for Nortel Networks' BayRS routers. This includes BCN, BLN, ASN, ARN,
|
||||||
|
and AN routers.
|
||||||
|
|
||||||
|
See SNMP::Info::Layer3::BayRS for where to get MIBs required.
|
||||||
|
|
||||||
=item SNMP::Info::Layer3::C3550
|
=item SNMP::Info::Layer3::C3550
|
||||||
|
|
||||||
@@ -416,6 +461,26 @@ Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running IOS.
|
|||||||
This class covers Catalyst 6500s in native mode, hybrid mode. Catalyst 4000's, 3750's, 2970's
|
This class covers Catalyst 6500s in native mode, hybrid mode. Catalyst 4000's, 3750's, 2970's
|
||||||
and probably others.
|
and probably others.
|
||||||
|
|
||||||
|
=item SNMP::Info::Layer3::Contivity
|
||||||
|
|
||||||
|
Subclass for Nortel Networks' Contivity VPN concentrators.
|
||||||
|
|
||||||
|
See SNMP::Info::Layer3::Contivity for where to get MIBs required.
|
||||||
|
|
||||||
|
=item SNMP::Info::Layer3::Foundry
|
||||||
|
|
||||||
|
Subclass for older Foundry Network devices. Outdated, but being updated for newer devices.
|
||||||
|
|
||||||
|
Requires FOUNDRY-SN-ROOT-MIB.
|
||||||
|
|
||||||
|
See SNMP::Info::Layer3::Foundry for more info.
|
||||||
|
|
||||||
|
=item SNMP::Info::Layer3::Passport
|
||||||
|
|
||||||
|
Subclass for Nortel Networks' Passport 8600 series switches.
|
||||||
|
|
||||||
|
See SNMP::Info::Layer3::Passport for where to get MIBs required.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=back
|
=back
|
||||||
@@ -423,8 +488,8 @@ and probably others.
|
|||||||
=head2 Thanks
|
=head2 Thanks
|
||||||
|
|
||||||
Thanks for testing and coding help (in no particular order) to :
|
Thanks for testing and coding help (in no particular order) to :
|
||||||
Andy Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz, and
|
Andy Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz,
|
||||||
people listed on the Netdisco README!
|
Eric Miller, and people listed on the Netdisco README!
|
||||||
|
|
||||||
=head1 USAGE
|
=head1 USAGE
|
||||||
|
|
||||||
@@ -441,20 +506,23 @@ Creates a new object and connects via SNMP::Session.
|
|||||||
'BigInt' => 1
|
'BigInt' => 1
|
||||||
'DestHost' => 'myrouter',
|
'DestHost' => 'myrouter',
|
||||||
'Community' => 'public',
|
'Community' => 'public',
|
||||||
'Version' => 2
|
'Version' => 2,
|
||||||
|
'MibDirs' => ['dir1','dir2','dir3'],
|
||||||
) or die;
|
) or die;
|
||||||
|
|
||||||
SNMP::Info Specific Arguments :
|
SNMP::Info Specific Arguments :
|
||||||
|
|
||||||
AutoSpecify = Returns an object of a more specific device class
|
AutoSpecify = Returns an object of a more specific device class
|
||||||
*See specify() entry*
|
*See specify() entry*
|
||||||
Debug = Prints Lots of debugging messages
|
|
||||||
Session = SNMP::Session object to use instead of connecting on own.
|
|
||||||
BigInt = Return Math::BigInt objects for 64 bit counters. Sets on a global scope, not object.
|
BigInt = Return Math::BigInt objects for 64 bit counters. Sets on a global scope, not object.
|
||||||
|
Debug = Prints Lots of debugging messages
|
||||||
|
MibDirs = Array ref to list of directories in which to look for MIBs. Note this will
|
||||||
|
be in addition to the ones setup in snmp.conf at the system level.
|
||||||
RetryNoSuch = When using SNMP Version 1, try reading values even if they come back
|
RetryNoSuch = When using SNMP Version 1, try reading values even if they come back
|
||||||
as "no such variable in this MIB". Defaults to true, set to false if
|
as "no such variable in this MIB". Defaults to true, set to false if
|
||||||
so desired. This feature lets you read SNMPv2 data from an SNMP version
|
so desired. This feature lets you read SNMPv2 data from an SNMP version
|
||||||
1 connection, and should probably be left on.
|
1 connection, and should probably be left on.
|
||||||
|
Session = SNMP::Session object to use instead of connecting on own.
|
||||||
|
|
||||||
All other arguments are passed to SNMP::Session.
|
All other arguments are passed to SNMP::Session.
|
||||||
|
|
||||||
@@ -498,13 +566,6 @@ sub new {
|
|||||||
$new_obj->{munge} = \%{$class . '::MUNGE'};
|
$new_obj->{munge} = \%{$class . '::MUNGE'};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize mibs if not done
|
|
||||||
my $init_ref = $new_obj->{init};
|
|
||||||
unless ( $$init_ref ) {
|
|
||||||
$new_obj->init();
|
|
||||||
$$init_ref=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# SNMP::Info specific args :
|
# SNMP::Info specific args :
|
||||||
my $auto_specific = 0;
|
my $auto_specific = 0;
|
||||||
if (defined $args{AutoSpecify}){
|
if (defined $args{AutoSpecify}){
|
||||||
@@ -526,6 +587,17 @@ sub new {
|
|||||||
$BIGINT = $args{BigInt};
|
$BIGINT = $args{BigInt};
|
||||||
delete $args{BigInt};
|
delete $args{BigInt};
|
||||||
}
|
}
|
||||||
|
if (defined $args{MibDirs}){
|
||||||
|
$new_obj->{mibdirs} = $args{MibDirs};
|
||||||
|
delete $args{MibDirs};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initialize mibs if not done
|
||||||
|
my $init_ref = $new_obj->{init};
|
||||||
|
unless ( $$init_ref ) {
|
||||||
|
$new_obj->init();
|
||||||
|
$$init_ref=1;
|
||||||
|
}
|
||||||
|
|
||||||
$new_obj->{nosuch} = $args{RetryNoSuch} || $NOSUCH;
|
$new_obj->{nosuch} = $args{RetryNoSuch} || $NOSUCH;
|
||||||
|
|
||||||
@@ -632,18 +704,26 @@ Algorithm for Subclass Detection:
|
|||||||
Catalyst 3550,3548,3560 -> SNMP::Info::Layer3::C3550
|
Catalyst 3550,3548,3560 -> SNMP::Info::Layer3::C3550
|
||||||
Catalyst 6500, 4000, 3750 -> SNMP::Info::Layer3::C6500
|
Catalyst 6500, 4000, 3750 -> SNMP::Info::Layer3::C6500
|
||||||
Foundry -> SNMP::Info::Layer3::Foundry
|
Foundry -> SNMP::Info::Layer3::Foundry
|
||||||
|
Nortel Passport LAN -> SNMP::Info::Layer3::Passport
|
||||||
|
Alteon Ace Director -> SNMP::Info::Layer3::AlteonAD
|
||||||
|
Nortel Contivity -> SNMP::Info::Layer3::Contivity
|
||||||
|
Nortel BayRS Router -> SNMP::Info::Layer3::BayRS
|
||||||
Elsif Layer2 (no Layer3) -> SNMP::Info::Layer2
|
Elsif Layer2 (no Layer3) -> SNMP::Info::Layer2
|
||||||
Aironet - IOS Devices -> SNMP::Info::Layer2::Aironet
|
Aironet - IOS Devices -> SNMP::Info::Layer2::Aironet
|
||||||
Bay Networks -> SNMP::Info::Layer2::Bay
|
|
||||||
Catalyst 1900 -> SNMP::Info::Layer2::C1900
|
Catalyst 1900 -> SNMP::Info::Layer2::C1900
|
||||||
Catalyst 2900XL,2950,3500XL -> SNMP::Info::Layer2::C2900
|
Catalyst 2900XL,2950,3500XL -> SNMP::Info::Layer2::C2900
|
||||||
Catalyst 2970 -> SNMP::Info::Layer3::C6500
|
Catalyst 2970 -> SNMP::Info::Layer3::C6500
|
||||||
Catalyst 3550/3548 -> SNMP::Info::Layer3::C3550
|
Catalyst 3550/3548 -> SNMP::Info::Layer3::C3550
|
||||||
Catalyst WS-C 2926,5xxx -> SNMP::Info::Layer2::Catalyst
|
Catalyst WS-C 2926,5xxx -> SNMP::Info::Layer2::Catalyst
|
||||||
HP Procurve -> SNMP::Info::Layer2::HP
|
HP Procurve -> SNMP::Info::Layer2::HP
|
||||||
|
Nortel/Bay Centillion ATM -> SNMP::Info::Layer2::Centillion
|
||||||
|
Nortel/Bay Baystack -> SNMP::Info::Layer2::Baystack
|
||||||
|
Nortel AP 222x -> SNMP::Info::Layer2::NAP222x
|
||||||
|
Orinco AP -> SNMP::Info::Layer2::Orinoco
|
||||||
Elsif Layer1 Support -> SNMP::Info::Layer1
|
Elsif Layer1 Support -> SNMP::Info::Layer1
|
||||||
Allied -> SNMP::Info::Layer1::Allied
|
Allied -> SNMP::Info::Layer1::Allied
|
||||||
Asante -> SNMP::Info::Layer1::Asante
|
Asante -> SNMP::Info::Layer1::Asante
|
||||||
|
Nortel/Bay Hub -> SNMP::Info::Layer1::Bayhub
|
||||||
Else -> SNMP::Info
|
Else -> SNMP::Info
|
||||||
ZyXEL_DSLAM -> SNMP::Info::Layer2::ZyXEL_DSLAM
|
ZyXEL_DSLAM -> SNMP::Info::Layer2::ZyXEL_DSLAM
|
||||||
|
|
||||||
@@ -680,6 +760,14 @@ sub device_type {
|
|||||||
$objtype = 'SNMP::Info::Layer3::C6500' if ($desc =~ /cisco/i and $desc =~ /3750/);
|
$objtype = 'SNMP::Info::Layer3::C6500' if ($desc =~ /cisco/i and $desc =~ /3750/);
|
||||||
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /Catalyst 4000/;
|
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /Catalyst 4000/;
|
||||||
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /s72033_rp/;
|
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /s72033_rp/;
|
||||||
|
# Nortel Passport 8600
|
||||||
|
$objtype = 'SNMP::Info::Layer3::Passport' if $desc =~ /Passport/;
|
||||||
|
# Nortel Alteon AD Series
|
||||||
|
$objtype = 'SNMP::Info::Layer3::AlteonAD' if $desc =~ /Alteon\s[1A][8D]/;
|
||||||
|
# Nortel Contivity
|
||||||
|
$objtype = 'SNMP::Info::Layer3::Contivity' if $desc =~ /\bCES\b/;
|
||||||
|
# Nortel BayRS
|
||||||
|
$objtype = 'SNMP::Info::Layer3::BayRS' if $desc =~ /^\sImage:\s+rel\//;
|
||||||
|
|
||||||
# Allied Telesyn Layer2 managed switches. They report they have L3 support
|
# Allied Telesyn Layer2 managed switches. They report they have L3 support
|
||||||
$objtype = 'SNMP::Info::Layer2::Allied' if ($desc =~ /Allied.*AT-80\d{2}\S*/i);
|
$objtype = 'SNMP::Info::Layer2::Allied' if ($desc =~ /Allied.*AT-80\d{2}\S*/i);
|
||||||
@@ -710,8 +798,20 @@ sub device_type {
|
|||||||
# HP
|
# HP
|
||||||
$objtype = 'SNMP::Info::Layer2::HP' if ($desc =~ /HP.*ProCurve/);
|
$objtype = 'SNMP::Info::Layer2::HP' if ($desc =~ /HP.*ProCurve/);
|
||||||
|
|
||||||
# Bay Switch
|
# Centillion ATM
|
||||||
$objtype = 'SNMP::Info::Layer2::Bay' if ($desc =~ /BayStack/);
|
$objtype = 'SNMP::Info::Layer2::Centillion' if ($desc =~ /MCP/);
|
||||||
|
|
||||||
|
# BPS
|
||||||
|
$objtype = 'SNMP::Info::Layer2::Baystack' if ($desc =~ /Business\sPolicy\sSwitch/i);
|
||||||
|
|
||||||
|
# BayStack Numbered
|
||||||
|
$objtype = 'SNMP::Info::Layer2::Baystack' if ($desc =~ /BayStack\s[345]\d/);
|
||||||
|
|
||||||
|
# Nortel AP 222X
|
||||||
|
$objtype = 'SNMP::Info::Layer2::NAP222x' if ($desc =~ /Access\s+Point\s+222/);
|
||||||
|
|
||||||
|
# Orinco
|
||||||
|
$objtype = 'SNMP::Info::Layer2::Orinoco' if ($desc =~ /AP-\d{3}|WavePOINT/);
|
||||||
|
|
||||||
# Aironet - IOS
|
# Aironet - IOS
|
||||||
$objtype = 'SNMP::Info::Layer2::Aironet' if ($desc =~ /(C1100|AP1200)/);
|
$objtype = 'SNMP::Info::Layer2::Aironet' if ($desc =~ /(C1100|AP1200)/);
|
||||||
@@ -725,6 +825,9 @@ sub device_type {
|
|||||||
$objtype = 'SNMP::Info::Layer1::Allied' if ($desc =~ /allied/i);
|
$objtype = 'SNMP::Info::Layer1::Allied' if ($desc =~ /allied/i);
|
||||||
$objtype = 'SNMP::Info::Layer1::Asante' if ($desc =~ /asante/i);
|
$objtype = 'SNMP::Info::Layer1::Asante' if ($desc =~ /asante/i);
|
||||||
|
|
||||||
|
# Bay Hub
|
||||||
|
$objtype = 'SNMP::Info::Layer1::Bayhub' if ($desc =~ /NMM.*Agent/);
|
||||||
|
|
||||||
# These devices don't claim to have Layer1-3 but we like em anyways.
|
# These devices don't claim to have Layer1-3 but we like em anyways.
|
||||||
} else {
|
} else {
|
||||||
$objtype = 'SNMP::Info::Layer2::ZyXEL_DSLAM' if ($desc =~ /8-port .DSL Module\(Annex .\)/i);
|
$objtype = 'SNMP::Info::Layer2::ZyXEL_DSLAM' if ($desc =~ /8-port .DSL Module\(Annex .\)/i);
|
||||||
@@ -1598,10 +1701,12 @@ Makes human friendly speed ratings using %SPEED_MAP
|
|||||||
'11000000' => '11 Mbps',
|
'11000000' => '11 Mbps',
|
||||||
'20000000' => '20 Mbps',
|
'20000000' => '20 Mbps',
|
||||||
'16000000' => '16 Mbps',
|
'16000000' => '16 Mbps',
|
||||||
|
'16777216' => '16 Mbps',
|
||||||
'44210000' => 'T3',
|
'44210000' => 'T3',
|
||||||
'44736000' => 'T3',
|
'44736000' => 'T3',
|
||||||
'45000000' => '45 Mbps',
|
'45000000' => '45 Mbps',
|
||||||
'45045000' => 'DS3',
|
'45045000' => 'DS3',
|
||||||
|
'46359642' => 'DS3',
|
||||||
'64000000' => '64 Mbps',
|
'64000000' => '64 Mbps',
|
||||||
'100000000' => '100 Mbps',
|
'100000000' => '100 Mbps',
|
||||||
'149760000' => 'ATM on OC-3',
|
'149760000' => 'ATM on OC-3',
|
||||||
@@ -1632,10 +1737,12 @@ Makes human friendly speed ratings using %SPEED_MAP
|
|||||||
'11000000' => '11 Mbps',
|
'11000000' => '11 Mbps',
|
||||||
'20000000' => '20 Mbps',
|
'20000000' => '20 Mbps',
|
||||||
'16000000' => '16 Mbps',
|
'16000000' => '16 Mbps',
|
||||||
|
'16777216' => '16 Mbps',
|
||||||
'44210000' => 'T3',
|
'44210000' => 'T3',
|
||||||
'44736000' => 'T3',
|
'44736000' => 'T3',
|
||||||
'45000000' => '45 Mbps',
|
'45000000' => '45 Mbps',
|
||||||
'45045000' => 'DS3',
|
'45045000' => 'DS3',
|
||||||
|
'46359642' => 'DS3',
|
||||||
'51850000' => 'OC-1',
|
'51850000' => 'OC-1',
|
||||||
'64000000' => '64 Mbps',
|
'64000000' => '64 Mbps',
|
||||||
'100000000' => '100 Mbps',
|
'100000000' => '100 Mbps',
|
||||||
@@ -1755,12 +1862,21 @@ sub init {
|
|||||||
if ($major < 5){
|
if ($major < 5){
|
||||||
# Seems to work under 4.2.0
|
# Seems to work under 4.2.0
|
||||||
} elsif ($major == 5 and $minor == 0 and $rev < 2){
|
} elsif ($major == 5 and $minor == 0 and $rev < 2){
|
||||||
carp("SNMP 5.0.1 seems to be rather buggy. Upgrade.\n");
|
carp("Net-SNMP 5.0.1 seems to be rather buggy. Upgrade.\n");
|
||||||
# This is a bug in net-snmp 5.0.1 perl module
|
# This is a bug in net-snmp 5.0.1 perl module
|
||||||
# see http://groups.google.com/groups?th=47aed6bf7be6a0f5
|
# see http://groups.google.com/groups?th=47aed6bf7be6a0f5
|
||||||
&SNMP::init_snmp("perl");
|
&SNMP::init_snmp("perl");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add MibDirs
|
||||||
|
my $mibdirs = $self->{mibdirs} || [];
|
||||||
|
|
||||||
|
foreach my $d (@$mibdirs){
|
||||||
|
next unless -d $d;
|
||||||
|
print "SNMP::Info::init() - Adding new mibdir:$d\n" if $self->debug();
|
||||||
|
&SNMP::addMibDirs($d);
|
||||||
|
}
|
||||||
|
|
||||||
my $mibs = $self->mibs();
|
my $mibs = $self->mibs();
|
||||||
|
|
||||||
foreach my $mib (keys %$mibs){
|
foreach my $mib (keys %$mibs){
|
||||||
@@ -1915,6 +2031,9 @@ sub _global{
|
|||||||
print "SNMP::Info::_global $attr : $oid\n" if $self->debug();
|
print "SNMP::Info::_global $attr : $oid\n" if $self->debug();
|
||||||
my $val = $sess->get($oid);
|
my $val = $sess->get($oid);
|
||||||
|
|
||||||
|
# mark as gotten. Even if it fails below, we don't want to keep failing.
|
||||||
|
$self->{"_$attr"}=undef;
|
||||||
|
|
||||||
if ($sess->{ErrorStr} ){
|
if ($sess->{ErrorStr} ){
|
||||||
$self->error_throw("SNMP::Info::_global($attr) $sess->{ErrorStr}");
|
$self->error_throw("SNMP::Info::_global($attr) $sess->{ErrorStr}");
|
||||||
return undef;
|
return undef;
|
||||||
@@ -2243,7 +2362,7 @@ sub AUTOLOAD {
|
|||||||
# Next check for entry in %GLOBALS
|
# Next check for entry in %GLOBALS
|
||||||
if (defined $globals{$attr} ){
|
if (defined $globals{$attr} ){
|
||||||
# Return Cached Value if exists
|
# Return Cached Value if exists
|
||||||
return $self->{"_${attr}"} if defined $self->{"_${attr}"};
|
return $self->{"_${attr}"} if exists $self->{"_${attr}"};
|
||||||
# Fetch New Value
|
# Fetch New Value
|
||||||
return $self->_global( $attr );
|
return $self->_global( $attr );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user