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';

In reply to Re^2: Storing a tied hash of SNMP by linxdev
in thread Storing a tied hash of SNMP by linxdev

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.