diff options
Diffstat (limited to 'perl/SNMP/examples/tablewalk.pl')
-rw-r--r-- | perl/SNMP/examples/tablewalk.pl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/perl/SNMP/examples/tablewalk.pl b/perl/SNMP/examples/tablewalk.pl new file mode 100644 index 0000000..6fe344c --- /dev/null +++ b/perl/SNMP/examples/tablewalk.pl @@ -0,0 +1,19 @@ +# snmpwalk of a single table +# getnext of 3 columns from ipAddrEntry table +# stop after last row in table + +use SNMP 1.8; + +my $host = shift || localhost; +my $comm = shift || public; + +my $sess = new SNMP::Session ( DestHost => $host, Community => $comm ); + +my $vars = new SNMP::VarList([ipAdEntAddr],[ipAdEntIfIndex],[ipAdEntNetMask]); + +for (@vals = $sess->getnext($vars); + $vars->[0]->tag =~ /ipAdEntAddr/ # still in table + and not $sess->{ErrorStr}; # and not end of mib or other error + @vals = $sess->getnext($vars)) { + print " ($vals[1]) $vals[0]/$vals[2]\n"; +} |