SNMP::Info

An Object Oriented Perl interface to network devices and MIBs through SNMP
Download

SNMP::Info Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Max Baker
  • Publisher web site:
  • http://search.cpan.org/~emiller/SNMP-Info-1.04/Info.pm

SNMP::Info Tags


SNMP::Info Description

An Object Oriented Perl interface to network devices and MIBs through SNMP SNMP::Info is an Object Oriented Perl interface to network devices and MIBs through SNMP.SYNOPSIS use SNMP::Info; my $info = new SNMP::Info( # Auto Discover more specific Device Class AutoSpecify => 1, Debug => 1, # The rest is passed to SNMP::Session DestHost => 'router', Community => 'public', Version => 2 ) or die "Can't connect to device.n"; my $err = $info->error(); die "SNMP Community or Version probably wrong connecting to device. $errn" if defined $err; $name = $info->name(); $class = $info->class(); print "SNMP::Info is using this device class : $classn"; # Find out the Duplex status for the ports my $interfaces = $info->interfaces(); my $i_duplex = $info->i_duplex(); # Get CDP Neighbor info my $c_if = $info->c_if(); my $c_ip = $info->c_ip(); my $c_port = $info->c_port(); # Print out data per port foreach my $iid (keys %$interfaces){ my $duplex = $i_duplex->{$iid}; # Print out physical port name, not snmp iid my $port = $interfaces->{$iid}; print "$port: "; print "$duplex duplex" if defined $duplex; # 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. my %c_map = reverse %$c_if; my $c_key = $c_map{$iid}; unless (defined $c_key) { print "nn"; next; } my $neighbor_ip = $c_ip->{$c_key}; my $neighbor_port = $c_port->{$c_key}; print " connected to $neighbor_ip / $neighbor_portn" if defined $neighbor_ip; print "n"; } Requirements: · Perl


SNMP::Info Related Software