jds has asked for the wisdom of the Perl Monks concerning the following question:
I have used Data::Dumper to view the returning information, and the error is there. I have used the translate() option of Net::SNMP and it only makes things worse. Also, the shell version of snmpwalk does not exhibit the problem at all! (But of course I would rather use perl modules rather than system calls.)
Again, most hardware addresses come through fine, but one example:
'000d56385734' is displayed as '^@^MV8W4'
And I can't find a relationship between the real address and the output - assuming there is one. Also, I get the same results from both the layer 2 switch the node is plugged in to, and the layer 3 core switch in the network - different manufacturers.
Following is a stripped down version of the code I am using (the final output is just a list of mac addresses that the switch knows about):
TIA John#!/usr/bin/perl use strict; use Net::SNMP; my ( $key ); my $session = Net::SNMP->session(Hostname => '1.2.3.4', Community => 'public'); print $session->error(); my $macoid = '1.3.6.1.2.1.17.4.3.1.1'; my $macref = $session->get_table($macoid); foreach $key (keys %{$macref}) { print "$macref->{$key} \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SNMP and Mac Addresses
by atcroft (Abbot) on Apr 07, 2004 at 20:18 UTC | |
|
Re: Net::SNMP and Mac Addresses
by Anonymous Monk on Apr 08, 2004 at 02:43 UTC | |
|
Re: Net::SNMP and Mac Addresses
by jds (Acolyte) on Apr 13, 2004 at 18:40 UTC | |
by Anonymous Monk on Apr 17, 2004 at 22:29 UTC | |
by Anonymous Monk on Dec 09, 2004 at 15:49 UTC |