my ($s,$e)=Net::SNMP->session(-hostname=> $ip, -community =>$community); if (!defined($s)) { printf("error: %s.\n", $e); exit 1; } $oid = ".1.3.6.1.4.1.9.9.42.1.2.1.1.2"; my @args = ( -varbindlist => [$oid]); while ( defined $s->get_next_request(@args) ) { $_ = ( keys(%{ $s->var_bind_list }) )[0]; if (!oid_base_match($oid, $_)) { last; } printf("%s => %s", $_, $s->var_bind_list->{$_}); my @n = split /\./, $_; print " (index: ",$n[$#n],")\n"; @args = (-varbindlist => [$_]); } # Let the user know about any errors if ($s->error() ne '') { print $s->error(),"\n"; }