Okay, I've got good news and bad news.
The good news is that this will mostly work, and I can add several things to the list of stuff I no longer have to worry about.
The bad news is I have to add new code to any module that needs to load MIBs. The new code is as follows:
@DIRS = `ls -1d /usr/local/share/snmp/mibs/TEMP/*`;
foreach $dir ( @DIRS ) {
chomp $dir;
&SNMP::addMibDirs("$dir");
}
Anyway, some more detail on the advantages:
- I don't have to modify environment variables. This is good because if $ENV{MIBDIRS} is previously unset, you have to find out where the site-wide MIBs are stored. While this is usually predictable, I'd rather not worry about it at all.
- I don't have to modify environment variables. By adding the package's own base MIB directory to the config file, the change can be made effective site-wide (using the config file in /etc) without worrying about users' various shells, changing their environments, etc.
- I can actually eliminate a config item I used to have in the code that kept track of the location of the site-wide MIBs that come with Net-SNMP. Again, less to worry about.
- In the course of investigating this, I've discovered the proper use of the &SNMP::loadModules() function AND I've learned enough about duplicate MIB detection that the package's own code will be a lot leaner and the post-install script can do a lot more to detect duplicates (thus avoiding several really annoying MIB problems I've had before).
I may even write a separate script just to detect duplicates, since the user has a nasty tendency to do that. :-)
Anyway, I want to thank all those who offered suggestions. Hopefully this will be the last time I have to worry about this. :-D
--Rhys
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.