I have started that. In the example I only want to run initMib once. Using mibtree.pl I'm stuck doing it at each execution of the program.
Looking at SNMP.pm I started at the first node of '.1' and used nextNode to create a very large object of the data. Around 15M. It is much faster for me to do a Storable::retrieve() on this than it is to parse all the MIB files via initMib.
My problem is that my hash keys are by numeric OID. To search by MIB Name::variable I have to walk a hash that has 60k entries. I need to also search via moduleID::label. If add mib keys for 'moduleID::label' => objectID then that will double the size of the object. Maybe use DBI and create a SQLite3 file instead? I'll need to test the performance of that.
Like this:
select oid from mib where moduleID = ? and label = ?
Object gen like this:
my $node = $SNMP::MIB{'.1'};
my $t = 0;
while(($node = $node->{'nextNode'})) {
$t++;
printf "%-40.40s %s::%s\n",$node->{'objectID'}, $node->{'moduleID'
+},$node->{'label'};
$data->{$node->{'objectID'}}{'objectID'} = $node->{'objectID'};
$data->{$node->{'objectID'}}{'moduleID'} = $node->{'moduleID'};
$data->{$node->{'objectID'}}{'label'} = $node->{'label'};
$data->{$node->{'objectID'}}{'type'} = $node->{'type'};
$data->{$node->{'objectID'}}{'description'} = $node->{'description
+'};
}
print "Total: $t\n";
#print Dumper(\%SNMP::MIB);
nstore $data ,'snmp-data.obj';