| 1 |
# snmpwalk of a single table |
| 2 |
# getnext of 3 columns from ipAddrEntry table |
| 3 |
# stop after last row in table |
| 4 |
|
| 5 |
use SNMP 1.8; |
| 6 |
|
| 7 |
my $host = shift || localhost; |
| 8 |
my $comm = shift || public; |
| 9 |
|
| 10 |
my $sess = new SNMP::Session ( DestHost => $host, Community => $comm ); |
| 11 |
|
| 12 |
my $vars = new SNMP::VarList([ipAdEntAddr],[ipAdEntIfIndex],[ipAdEntNetMask]); |
| 13 |
|
| 14 |
for (@vals = $sess->getnext($vars); |
| 15 |
$vars->[0]->tag =~ /ipAdEntAddr/ # still in table |
| 16 |
and not $sess->{ErrorStr}; # and not end of mib or other error |
| 17 |
@vals = $sess->getnext($vars)) { |
| 18 |
print " ($vals[1]) $vals[0]/$vals[2]\n"; |
| 19 |
} |