I use the following in a script I run to get a list of interfaces from Cisco... (perhaps the leading "." on your varbind is the culprit? - or not...)
...
use strict;
use Net::SNMP;
...
sub get_if_ids
{
my ( $hostname ) = @_;
my %ifs;
my $ifEntry = "1.3.6.1.2.1.2.2.1.2";
my ( $session, $error ) = Net::SNMP->session(
-hostname => $hostname,
-version => 1,
-community => "public" );
if ( !defined( $session ) )
{
print "ERROR: SNMP - $error\n";
return undef;
}
my $result = $session->get_next_request( -varbindlist => [$ifEntry
+] );
while ( defined( $result ) )
{
foreach my $key ( keys %$result )
{
if ( $key !~ /^$ifEntry/ )
{
$result = undef;
last;
}
# process $result...
# Update: $key is 1.3.6.1.2.1.2.2.1.2.n for the nth inte
+rface
# $result->{$key} is interface name
$result = $session->get_next_request( -varbindlist => [$ke
+y] );
}
}
$session->close();
return \%ifs;
}