I want to store %SNMP::MIB as an object, but I'm not sure if it is possible since it is a tied hash into the Net-SNMP library.
The initMib() function takes about 9s to execute since it processes many MIBs. These MIBs do not change so I'm thinking that if I could skip this step and just read in an object created from %SNMP::MIB I could save almost all of those 9 seconds.
I don't know if SNMP::initMib() creates the full structure of %SNMP::MIB of if files are still accessed when I look up values via OID within %SNMP::MIB. Anytime I try to traverse that hash I get an 'out of memory' error. Here is some code where I try to dump it.Anyone know if it is possible to do what I'm trying to do? If so, what is the best way?use SNMP; use Data::Dumper; use strict; if(not $ENV{'MIBS'}) { $ENV{'MIBS'} = 'ALL'; } if(not $ENV{'MIBDIRS'}) { $ENV{'MIBDIRS'} = '/usr/share/snmp/private:/usr/share/snmp/mibs'; } &SNMP::initMib(); $Data::dumper::Maxdepth = 2; $Data::dumper::Maxrecurse = 2; $Data::dumper::Deparse = 1; print Dumper(\%SNMP::MIB);
In reply to Storing a tied hash of SNMP by linxdev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |