I am attempting to use the following MIB .1.3.6.1.2.1.4.20.1.1 to retrieve
IP addresses using the Net::SNMP module. In the code I have written I
concatenate the the host ip address to the MIB in order to return the ip
address. What I am expecting to return is the IP address that I passed in
and all subsequent ip addresses that reside further down the tree from the
first ip address. For example when I use the snmpwalk command I receive the
following results.
snmpwalk -c xxxxxx 137.2xx.xxx.x 1.3.6.1.2.1.4.20.1.1
IpAddress: 127.x.x.x
IpAddress: 137.2xx.xy.xyy
IpAddress: 137.2xx.xxx.x
However, using the following code returns only one IP address. Is it
possible to use the Net::SNMP to produce the same results as the snmpwalk
command?
my $ipaddr_oid = ".1.3.6.1.2.1.4.20.1.1.$host_ip";
$response = $session->get_request($ipaddr_oid);
if (!defined($response))
{
$error_message = $session->error;
print "Error getting $ipaddr_oid: $error_message\n";
}
else
{
print SWITCHIPADDRESSFILE "\t$response->{$ipaddr_oid}";
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com