Hi,

When I try to get the arp table from any type of device (oid 1.3.6.1.2.1.4.22.1.3) with the snmp_util module, it returns the 6 character, instead of the hex byte value.

How can I convert a 6 byte word into the hex equivalent like 00:0a:8b:bd:62:8a.

Any help greatly appreciated

Bernard

Below, a sample program to show the results.


#!/usr/bin/perl
use SNMP_util;


my $IPADDR = $ARGV[0] || die "Oops, no ipaddr specified....";
my $COMM = $ARGV[1] || die "Oops, no community specified....";
my $OID = $ARGV[2] || die "Oops, no oid specified....";
print("Getting info for $IPADDR with comm $COMM ($OID)\n");

$HOST = $COMM . "@" . $IPADDR;
$SNMPVER = "1";
$SNMPSTR = "$HOST" . ":::::" . "$SNMPVER";
print("Getting table.\n");

$length = length($OID);
$oid = $OID;
   $oid = substr($oid,0,$length);
print "Trying 'getnext' on $host with $oid\n";
while ( substr($oid,0,$length) eq $OID ) {
 my @ret = &snmpgetnext($SNMPSTR, "$oid");
 foreach my $desc (@ret) {
   ($oid, $desc) = split(':', $desc, 2);
   $testStr = substr($oid,0,$length);
   if ( substr($oid,0,$length) eq $OID ) {
     print "$oid = $desc ($testStr)')\n";
   }
 }
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to