Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Storing a tied hash of SNMP

by linxdev (Sexton)
on Feb 24, 2016 at 02:21 UTC ( [id://1155978]=note: print w/replies, xml ) Need Help??


in reply to Re: Storing a tied hash of SNMP
in thread Storing a tied hash of SNMP

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

Replies are listed 'Best First'.
Re^3: Storing a tied hash of SNMP
by beech (Parson) on Feb 24, 2016 at 03:22 UTC

    Maybe use DBI and create a SQLite3 file instead?

    Sure, if you need SQL query abilities, DBD::SQLite is good for that

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1155978]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found