make update

This commit is contained in:
Eric Miller
2006-04-07 03:48:24 +00:00
parent 8aee915872
commit 4939a18a6c

107
README
View File

@@ -1,15 +1,22 @@
NAME NAME
SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs
through SNMP. through SNMP.
VERSION VERSION
SNMP::Info - Version 1.0 SNMP::Info - Version 1.0
AUTHOR AUTHOR
SNMP::Info was created at UCSC for the netdisco project SNMP::Info was created at UCSC for the netdisco project
(www.netdisco.org) and is written and maintained by Max Baker. (www.netdisco.org) and was orginally written by Max Baker.
Currently being maintained by team of Open Source authors headed by Eric
Miller and Bill Fenner.
SYNOPSIS SYNOPSIS
use SNMP::Info; use SNMP::Info;
my $info = new SNMP::Info( my $info = new SNMP::Info(
@@ -44,26 +51,34 @@ SYNOPSIS
# Print out physical port name, not snmp iid # Print out physical port name, not snmp iid
my $port = $interfaces->{$iid}; my $port = $interfaces->{$iid};
print "$port: ";
print "$duplex duplex" if defined $duplex;
# The CDP Table has table entries different than the interface tables. # The CDP Table has table entries different than the interface tables.
# So we use c_if to get the map from cdp table to interface table. # So we use c_if to get the map from cdp table to interface table.
my %c_map = reverse %$c_if; my %c_map = reverse %$c_if;
my $c_key = $c_map{$iid}; my $c_key = $c_map{$iid};
unless (defined $c_key) {
print "\n\n";
next;
}
my $neighbor_ip = $c_ip->{$c_key}; my $neighbor_ip = $c_ip->{$c_key};
my $neighbor_port = $c_port->{$c_key}; my $neighbor_port = $c_port->{$c_key};
print "$port: $duplex duplex"; print " connected to $neighbor_ip / $neighbor_port\n" if defined $neighbor_ip;
print " connected to $neighbor_ip / $neighbor_port\n" if defined $remote_ip;
print "\n"; print "\n";
} }
SUPPORT SUPPORT
Please direct all support, help, and bug requests to the snmp-info-users Please direct all support, help, and bug requests to the snmp-info-users
Mailing List at Mailing List at
<http://lists.sourceforge.net/lists/listinfo/snmp-info-users>. <http://lists.sourceforge.net/lists/listinfo/snmp-info-users>.
DESCRIPTION DESCRIPTION
SNMP::Info gives an object oriented interface to information obtained SNMP::Info gives an object oriented interface to information obtained
through SNMP. through SNMP.
@@ -93,6 +108,7 @@ DESCRIPTION
a couple hashes. See EXTENDING SNMP::INFO. a couple hashes. See EXTENDING SNMP::INFO.
REQUIREMENTS REQUIREMENTS
1. Net-SNMP 1. Net-SNMP
To use this module, you must have Net-SNMP installed on your system. To use this module, you must have Net-SNMP installed on your system.
More specifically you need the Perl modules that come with it. More specifically you need the Perl modules that come with it.
@@ -130,6 +146,7 @@ REQUIREMENTS
directory and that the MIBs are world-readable. directory and that the MIBs are world-readable.
DESIGN GOALS DESIGN GOALS
1. Use of textual MIB leaf identifier and enumerated values 1. Use of textual MIB leaf identifier and enumerated values
* All values are retrieved via MIB Leaf node names * All values are retrieved via MIB Leaf node names
@@ -157,12 +174,14 @@ DESIGN GOALS
inclusion in the next version. inclusion in the next version.
SUBCLASSES SUBCLASSES
These are the subclasses that implement MIBs and support devices: These are the subclasses that implement MIBs and support devices:
Required MIBs not included in the install instructions above are noted Required MIBs not included in the install instructions above are noted
here. here.
MIB Subclasses MIB Subclasses
These subclasses implement method to access one or more MIBs. These are These subclasses implement method to access one or more MIBs. These are
not used directly, but rather inherited from device subclasses. not used directly, but rather inherited from device subclasses.
@@ -178,7 +197,7 @@ SUBCLASSES
SNMP::Info::CDP SNMP::Info::CDP
CISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited by CISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited by
devices serving Layer2 or Layer3. Cisco and HP devices.
SNMP::Info::CiscoImage SNMP::Info::CiscoImage
CISCO-IMAGE-MIB. A collection of OIDs providing IOS image CISCO-IMAGE-MIB. A collection of OIDs providing IOS image
@@ -231,6 +250,7 @@ SUBCLASSES
by Nortel/Bay/Synoptics switches and hubs. by Nortel/Bay/Synoptics switches and hubs.
Device Subclasses Device Subclasses
These subclasses inherit from one or more classes to provide a common These subclasses inherit from one or more classes to provide a common
interface to data obtainable from network devices. interface to data obtainable from network devices.
@@ -275,9 +295,9 @@ SUBCLASSES
Depreciated. Use BayStack. Depreciated. Use BayStack.
SNMP::Info::Layer2::Baystack SNMP::Info::Layer2::Baystack
Subclass for Nortel/Bay Baystack switches. This includes 303, Subclass for Nortel/Bay Ethernet Switch/Baystack switches. This
304, 350, 380, 410, 420, 425, 450, 460, 470, 5510, 5520, 5530, includes 303, 304, 350, 380, 410, 420, 425, 450, 460, 470, 5510,
Business Policy Switch (BPS) and probably others. 5520, 5530, Business Policy Switch (BPS) and probably others.
SNMP::Info::Layer2::C1900 SNMP::Info::Layer2::C1900
Subclass for Cisco Catalyst 1900 and 1900c Devices running Subclass for Cisco Catalyst 1900 and 1900c Devices running
@@ -334,13 +354,16 @@ SUBCLASSES
Subclass for Nortel Alteon Ace Director series L2-7 switches. Subclass for Nortel Alteon Ace Director series L2-7 switches.
SNMP::Info::Layer3::BayRS SNMP::Info::Layer3::BayRS
Subclass for Nortel BayRS routers. This includes BCN, BLN, ASN, Subclass for Nortel Multiprotocol/BayRS routers. This includes
ARN, and AN routers. BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers.
SNMP::Info::Layer3::C3550 SNMP::Info::Layer3::C3550
Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running
IOS. IOS.
SNMP::Info::Layer3::C4000
This class covers Catalyst 4000s and 4500s.
SNMP::Info::Layer3::C6500 SNMP::Info::Layer3::C6500
This class covers Catalyst 6500s in native mode, hybrid mode. This class covers Catalyst 6500s in native mode, hybrid mode.
Catalyst 4000's, 3750's, 2970's and probably others. Catalyst 4000's, 3750's, 2970's and probably others.
@@ -350,7 +373,7 @@ SUBCLASSES
on CiscoVTP. on CiscoVTP.
SNMP::Info::Layer3::Contivity SNMP::Info::Layer3::Contivity
Subclass for Nortel Contivity VPN concentrators. Subclass for Nortel Contivity/VPN Routers.
SNMP::Info::Layer3::Extreme SNMP::Info::Layer3::Extreme
Subclass for Extreme Networks switches. Subclass for Extreme Networks switches.
@@ -365,20 +388,27 @@ SUBCLASSES
See SNMP::Info::Layer3::Foundry for more info. See SNMP::Info::Layer3::Foundry for more info.
SNMP::Info::Layer3::Passport SNMP::Info::Layer3::Juniper
Subclass for Nortel Passport 8000 series and Accelar series Subclass for Juniper devices.
switches.
SNMP::Info::Layer3::N1600 SNMP::Info::Layer3::N1600
Subclass for Nortel 1600 series switches. Subclass for Nortel Ethernet Routing Switch 1600 series.
SNMP::Info::Layer3::Passport
Subclass for Nortel Ethernet Routing Switch/Passport 8000 series
and Accelar series switches.
Thanks Thanks
Thanks for testing and coding help (in no particular order) to : Andy Thanks for testing and coding help (in no particular order) to : Andy
Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz, Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz,
Eric Miller, and people listed on the Netdisco README! Mike Hunter, Justin Hunter, Brian Chow and people listed on the Netdisco
README!
USAGE USAGE
Constructor Constructor
new() new()
Creates a new object and connects via SNMP::Session. Creates a new object and connects via SNMP::Session.
@@ -475,6 +505,7 @@ USAGE
version 2 and then fallback to version 1. version 2 and then fallback to version 1.
Data is Cached Data is Cached
Methods and subroutines requesting data from a device will only load the Methods and subroutines requesting data from a device will only load the
data once, and then return cached versions of that data. data once, and then return cached versions of that data.
@@ -485,6 +516,7 @@ USAGE
globals and table methods. globals and table methods.
Object Scalar Methods Object Scalar Methods
These are for package related data, not direcly supplied from SNMP. These are for package related data, not direcly supplied from SNMP.
$info->clear_cache() $info->clear_cache()
@@ -519,16 +551,18 @@ USAGE
Aironet (BR500,AP340,350,1200) -> SNMP::Info::Layer3::Aironet Aironet (BR500,AP340,350,1200) -> SNMP::Info::Layer3::Aironet
AP4800... All Non IOS AP4800... All Non IOS
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 4000,4500 -> SNMP::Info::Layer3::C4000
Catalyst 6500, 3750 -> SNMP::Info::Layer3::C6500
Cisco Generic L3 IOS device -> SNMP::Info::Layer3::Cisco Cisco Generic L3 IOS device -> SNMP::Info::Layer3::Cisco
Extreme -> SNMP::Info::Layer3::Extreme Extreme -> SNMP::Info::Layer3::Extreme
Foundry -> SNMP::Info::Layer3::Foundry Foundry -> SNMP::Info::Layer3::Foundry
Juniper -> SNMP::Info::Layer3::Juniper
Nortel Passport/Accelar LAN -> SNMP::Info::Layer3::Passport Nortel Passport/Accelar LAN -> SNMP::Info::Layer3::Passport
Nortel/Bay Baystack -> SNMP::Info::Layer2::Baystack Nortel/Bay Baystack -> SNMP::Info::Layer2::Baystack
Alteon Ace Director -> SNMP::Info::Layer3::AlteonAD Alteon Ace Director -> SNMP::Info::Layer3::AlteonAD
Nortel Contivity -> SNMP::Info::Layer3::Contivity Nortel Contivity -> SNMP::Info::Layer3::Contivity
Nortel BayRS Router -> SNMP::Info::Layer3::BayRS 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
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
@@ -592,6 +626,7 @@ USAGE
Indexing.html> Indexing.html>
Globals (Scalar Methods) Globals (Scalar Methods)
These are methods to return scalar data from RFC1213. These are methods to return scalar data from RFC1213.
Some subset of these is probably available for any network device that Some subset of these is probably available for any network device that
@@ -640,6 +675,7 @@ USAGE
(ipForwarding) (ipForwarding)
Table Methods Table Methods
Each of these methods returns a hash_reference to a hash keyed on the Each of these methods returns a hash_reference to a hash keyed on the
interface index in SNMP. interface index in SNMP.
@@ -654,6 +690,7 @@ USAGE
cases changes between reboots of the network device. cases changes between reboots of the network device.
Partial Table Fetches Partial Table Fetches
If you want to get only a part of an SNMP table and you know the IID for If you want to get only a part of an SNMP table and you know the IID for
the part of the table that you want, you can specify it in the call: the part of the table that you want, you can specify it in the call:
@@ -667,6 +704,7 @@ USAGE
Partial table results are not cached. Partial table results are not cached.
Interface Information Interface Information
$info->interfaces() $info->interfaces()
This methods is overriden in each subclass to provide a mapping This methods is overriden in each subclass to provide a mapping
between the Interface Table Index (iid) and the physical port name. between the Interface Table Index (iid) and the physical port name.
@@ -704,7 +742,14 @@ USAGE
Speed of the link, human format. See munge_speed() later in document Speed of the link, human format. See munge_speed() later in document
for details. for details.
(ifSpeed) (ifSpeed, ifHighSpeed if necessary)
$info->i_speed_high()
Speed of a high-speed link, human format. See munge_highspeed()
later in document for details. You should not need to call this
directly, as i_speed() will call it if it needs to.
(ifHighSpeed)
$info->i_mac() $info->i_mac()
MAC address of the interface. Note this is just the MAC of the port, MAC address of the interface. Note this is just the MAC of the port,
@@ -726,7 +771,7 @@ USAGE
$info->i_lastchange() $info->i_lastchange()
The value of sysUpTime when this port last changed states (up,down). The value of sysUpTime when this port last changed states (up,down).
(IfLastChange) (ifLastChange)
$info->i_name() $info->i_name()
Interface Name field. Supported by a smaller subset of devices, this Interface Name field. Supported by a smaller subset of devices, this
@@ -742,6 +787,7 @@ USAGE
(ifAlias) (ifAlias)
Interface Statistics Interface Statistics
$info->i_octet_in(), $info->i_octets_out(), $info->i_octet_in64(), $info->i_octet_in(), $info->i_octets_out(), $info->i_octet_in64(),
$info->i_octets_out64() $info->i_octets_out64()
Bandwidth. Bandwidth.
@@ -800,6 +846,7 @@ USAGE
(ifHCOutBroadcastPkts) (ifHCOutBroadcastPkts)
IP Address Table IP Address Table
Each entry in this table is an IP address in use on this device. Usually Each entry in this table is an IP address in use on this device. Usually
this is implemented in Layer3 Devices. this is implemented in Layer3 Devices.
@@ -824,6 +871,7 @@ USAGE
(ipAdEntBcastAddr) (ipAdEntBcastAddr)
IP Routing Table IP Routing Table
$info->ipr_route() $info->ipr_route()
The route in question. A value of 0.0.0.0 is the default gateway The route in question. A value of 0.0.0.0 is the default gateway
route. route.
@@ -939,6 +987,7 @@ USAGE
("ipRouteInfo") ("ipRouteInfo")
SETTING DATA VIA SNMP SETTING DATA VIA SNMP
This section explains how to use SNMP::Info to do SNMP Set operations. This section explains how to use SNMP::Info to do SNMP Set operations.
$info->set_METHOD($value) $info->set_METHOD($value)
@@ -968,6 +1017,7 @@ SETTING DATA VIA SNMP
subroutines will need to be added if they haven't been already. subroutines will need to be added if they haven't been already.
Quiet Mode Quiet Mode
SNMP::Info will not chirp anything to STDOUT unless there is a serious SNMP::Info will not chirp anything to STDOUT unless there is a serious
error (in which case it will probably die). error (in which case it will probably die).
@@ -982,7 +1032,9 @@ Quiet Mode
my $name = $info->name() or die "Couldn't get sysName!" . $name->error(); my $name = $info->name() or die "Couldn't get sysName!" . $name->error();
EXTENDING SNMP::INFO EXTENDING SNMP::INFO
Data Structures required in new Subclass Data Structures required in new Subclass
A class inheriting this class must implement these data structures : A class inheriting this class must implement these data structures :
$INIT $INIT
@@ -1025,6 +1077,7 @@ EXTENDING SNMP::INFO
) )
Sample Subclass Sample Subclass
Let's make a sample Layer 2 Device subclass. This class will inherit the Let's make a sample Layer 2 Device subclass. This class will inherit the
Cisco Vlan module as an example. Cisco Vlan module as an example.
@@ -1116,7 +1169,9 @@ EXTENDING SNMP::INFO
of SNMP::Info. of SNMP::Info.
SNMP::INFO INTERNALS SNMP::INFO INTERNALS
Object Namespace Object Namespace
Internal data is stored with bareword keys. For example $info->{debug} Internal data is stored with bareword keys. For example $info->{debug}
SNMP Data is stored or marked cached with keys starting with an SNMP Data is stored or marked cached with keys starting with an
@@ -1126,6 +1181,7 @@ SNMP::INFO INTERNALS
above. above.
Package Globals Package Globals
These set the default value for an object upon creation. These set the default value for an object upon creation.
$DEBUG $DEBUG
@@ -1147,12 +1203,14 @@ SNMP::INFO INTERNALS
for more info. Can change by passing BulkRepeaters option in new() for more info. Can change by passing BulkRepeaters option in new()
Data Munging Callback Subroutines Data Munging Callback Subroutines
munge_speed() munge_speed()
Makes human friendly speed ratings using %SPEED_MAP Makes human friendly speed ratings using %SPEED_MAP
%SPEED_MAP = ( %SPEED_MAP = (
'56000' => '56 kbps', '56000' => '56 kbps',
'64000' => '64 kbps', '64000' => '64 kbps',
'115000' => '115 kpbs',
'1500000' => '1.5 Mbps', '1500000' => '1.5 Mbps',
'1536000' => 'T1', '1536000' => 'T1',
'1544000' => 'T1', '1544000' => 'T1',
@@ -1171,6 +1229,8 @@ SNMP::INFO INTERNALS
'45000000' => '45 Mbps', '45000000' => '45 Mbps',
'45045000' => 'DS3', '45045000' => 'DS3',
'46359642' => 'DS3', '46359642' => 'DS3',
'51850000' => 'OC-1',
'54000000' => '54 Mbps',
'64000000' => '64 Mbps', '64000000' => '64 Mbps',
'100000000' => '100 Mbps', '100000000' => '100 Mbps',
'149760000' => 'ATM on OC-3', '149760000' => 'ATM on OC-3',
@@ -1184,6 +1244,9 @@ SNMP::INFO INTERNALS
'1000000000' => '1.0 Gbps', '1000000000' => '1.0 Gbps',
) )
munge_highspeed()
Makes human friendly speed ratings for ifHighSpeed
munge_ip() munge_ip()
Takes a binary IP and makes it dotted ASCII Takes a binary IP and makes it dotted ASCII
@@ -1213,6 +1276,7 @@ SNMP::INFO INTERNALS
Net-SNMP figured out. Heirarchy/precendence of MIBS in SNMP::Info. Net-SNMP figured out. Heirarchy/precendence of MIBS in SNMP::Info.
Internaly Used Functions Internaly Used Functions
$info->init() $info->init()
Used internally. Loads all entries in %MIBS. Used internally. Loads all entries in %MIBS.
@@ -1298,7 +1362,11 @@ SNMP::INFO INTERNALS
The first time ran, it will call $info->load_METHOD(). Every time The first time ran, it will call $info->load_METHOD(). Every time
after it will return cached data. after it will return cached data.
$info->snmp_connect_ip()
Returns true or false based upon snmp connectivity to an IP.
AUTOLOAD AUTOLOAD
Each entry in either %FUNCS or %GLOBALS is used by AUTOLOAD() to create Each entry in either %FUNCS or %GLOBALS is used by AUTOLOAD() to create
dynamic methods. dynamic methods.
@@ -1321,6 +1389,7 @@ SNMP::INFO INTERNALS
subclass. subclass.
COPYRIGHT AND LICENCE COPYRIGHT AND LICENCE
Changes from SNMP::Info Version 0.7 and on are: Copyright (c)2003, 2004 Changes from SNMP::Info Version 0.7 and on are: Copyright (c)2003, 2004
Max Baker - All rights reserved. Max Baker - All rights reserved.