From 43d01c506097176211e204fe64107bd4667598b0 Mon Sep 17 00:00:00 2001 From: Max Baker <> Date: Tue, 29 Apr 2003 18:09:10 +0000 Subject: [PATCH] added full information from mib and ver 0.4 documentation style --- Info/EtherLike.pm | 160 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 133 insertions(+), 27 deletions(-) diff --git a/Info/EtherLike.pm b/Info/EtherLike.pm index baa10334..aae282c5 100644 --- a/Info/EtherLike.pm +++ b/Info/EtherLike.pm @@ -28,7 +28,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package SNMP::Info::EtherLike; -$VERSION = 0.3; +$VERSION = 0.4; # $Id$ use strict; @@ -52,8 +52,25 @@ $INIT = 0; %FUNCS = ( # EtherLike StatsTable - 'el_index' => 'dot3StatsIndex', - 'el_duplex' => 'dot3StatsDuplexStatus', + 'el_chipset' => 'dot3StatsEtherChipSet', + 'el_coll_excess' => 'dot3StatsExcessiveCollisions', + 'el_coll_late' => 'dot3StatsLateCollisions', + 'el_coll_mult' => 'dot3StatsMultipleCollisionFrames', + 'el_coll_single' => 'dot3StatsSingleCollisionFrames', + 'el_duplex' => 'dot3StatsDuplexStatus', + 'el_error_alignment' => 'dot3StatsAlignmentErrors', + 'el_error_fcs' => 'dot3StatsFCSErrors', + 'el_error_cs' => 'dot3StatsCarrierSenseErrors', + 'el_error_frame' => 'dot3StatsFrameTooLongs', + 'el_error_mac_rec' => 'dot3StatsInternalMacReceiveErrors', + 'el_error_mac_xmit' => 'dot3StatsInternalMacTransmitErrors', + 'el_error_sqe' => 'dot3StatsSQETestErrors', + 'el_error_symbol' => 'dot3StatsSymbolErrors', + 'el_index' => 'dot3StatsIndex', + 'el_xmit_defer' => 'dot3StatsDeferredTransmissions', + # Ethernet-like Collision Statistics Group + 'el_coll_count' => 'dot3CollCount', + 'el_coll_freq' => 'dot3CollFrequencies' ); %MUNGE = ( %SNMP::Info::MUNGE ); @@ -66,52 +83,77 @@ __END__ SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB -=head1 DESCRIPTION - -SNMP::Info::EtherLike is a subclass of SNMP::Info that supplies -access to the ETHERLIKE-MIB used by some Layer 3 Devices such as Cisco routers. - -Use SNMP::Info directly, or create a subclass that inherits this one. - =head1 AUTHOR Max Baker (C) =head1 SYNOPSIS - my $el = new SNMP::Info::EtherLike(DestHost => 'myrouter', - Community => 'public'); + my $el = new SNMP::Info ( + AutoSpecify => 1, + Debug => 1, + DestHost => 'router', + Community => 'public', + Version => 2 + ); + + my $class = $cdp->class(); + print " Using device sub class : $class\n"; - my $el_decoder = $el->el_index(); - my $el_duplex = $el->el_duplex(); + # Find the duplex setting for a port on a device that implements ETHERLIKE-MIB + my $interfaces = $el->interfaces(); + my $el_index = $el->el_index(); + my $el_duplex = $el->el_duplex(); -=head1 CREATING AN OBJECT + foreach my $el_port (keys %$el_duplex){ + my $duplex = $el_duplex->{$el_port}; + my $iid = $el_index->{$el_port}; + my $port = $interfaces->{$iid}; + + $duplex = 'half' if $duplex =~/half/i; + $duplex = 'full' if $duplex =~/full/i; + $duplex = 'auto' if $duplex =~/auto/i; + + print "PORT:$port set to duplex:$duplex\n"; + } + +=head1 DESCRIPTION + +SNMP::Info::EtherLike is a subclass of SNMP::Info that supplies +access to the ETHERLIKE-MIB used by some Layer 3 Devices such as Cisco routers. + +Use or create a subclass of SNMP::Info that inherits this one. Do not use directly. + +=head2 Inherited Classes + +None. + +=head2 Required MIBs =over -=item new SNMP::Info::EtherLike() - -Arguments passed to new() are passed on to SNMP::Session::new() - - - my $el = new SNMP::Info::EtherLike( - DestHost => $host, - Community => 'public', - Version => 3,... - ) - die "Couldn't connect.\n" unless defined $el; +=item ETHERLIKE-MIB =back +MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz + =head1 GLOBALS +These are methods that return scalar values from SNMP + =over =item None =back -=head1 ETHERLIKE STATS TABLE (dot3StatsTable) +=head1 TABLE METHODS + +These are methods that return tables of information in the form of a reference +to a hash. + +=head2 ETHERLIKE STATS TABLE (dot3StatsTable) =over @@ -127,6 +169,70 @@ Returns reference to hash. Indexes Stats Table to Duplex Status of port. (B) +=item $el->el_chipset() + +(B) + +=item $el->el_coll_excess() + +(B) + +=item $el->el_coll_late() + +(B) + +=item $el->el_coll_mult() + +(B) + +=item $el->el_coll_single() + +(B) + +=item $el->el_error_alignment() + +(B) + +=item $el->el_error_fcs() + +(B) + +=item $el->el_error_cs() + +(B) + +=item $el->el_error_frame() + +(B) + +=item $el->el_error_mac_rec() + +(B) + +=item $el->el_error_mac_xmit() + +(B) + +=item $el->el_error_sqe() + +(B) + +=item $el->el_error_symbol() + +(B) + +=item $el->el_xmit_defer() + +(B) + +=item $el->el_coll_count() + +(B) + +=item $el->el_coll_freq() + +(B) + =back =cut