added files
[bcm963xx.git] / userapps / opensource / net-snmp / perl / SNMP / examples / mibtree.pl
1 use SNMP;
2 $SNMP::save_descriptions = 1; # must be set prior to mib initialization
3 SNMP::initMib(); # parses default list of Mib modules from default dirs
4
5 # read dotted decimal oid or symbolic name to look up
6 # partial name will be searched and all matches returned
7 $val = shift || die "supply partial or complete object name or identifier\n";
8
9 if ($node = $SNMP::MIB{$val}) {
10     print "$node:$node->{label} [$node->{objectID}]\n";
11     while (($k,$v) = each %$node) {
12         print "\t$k => $v\n";
13     }
14 } else {
15     while (($k,$v) = each %SNMP::MIB) {
16         print "$v->{label} [$v->{obj}]\n" #accepts unique partial key(objectID)
17             if $k =~ /$val/ or $v->{label} =~ /$val/;
18     }
19 }
20