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

Per-host MIB sets with Net-SNMP?

by 5haun (Scribe)
on Dec 12, 2016 at 05:06 UTC ( [id://1177626]=perlquestion: print w/replies, xml ) Need Help??

5haun has asked for the wisdom of the Perl Monks concerning the following question:

Greetings fellow monks,

I am using the Net-SNMP library and its Perl 'SNMP' module (latest versions), and I need to be able to load a different set of SNMP MIBs for each host I create an SNMP::Session object for (some of the hosts are running versions of an embedded OS which requires a matching version of the MIB).

I have been able to successfully create code which sets an initial environment where no MIBs are loaded (the MIBS and MIBDIRS environment variables are set to a null string in a BEGIN block and SNMP::initMib() is called after 'use SNMP'). I can also load just the MIBs I need easily enough; however, all MIB settings appear to be process global, and thus shared by all Sessions, so using different versions of the same MIB file for each Session does not seem possible.

Does anyone know if Net-SNMP's Perl 'SNMP' module provides a way to load MIBs which will only be used with a specific session? If not, does anyone know if using ithreads with Net-SNMP provides full separation or are there global things the underlying C library shares regardless if ithreads are used (i.e. will I have to resort to forks)?

So the one idea I had was to fork or ithread off a child before loading the version-specific MIBs (which would also be before calling SNMP::Session->new()), and then performing RPC or thread_q communication between the master and the child sessions, but that seems like a lot of effort, so I'm seeking your SNMP wisdom and experiences in case there is a simpler solution.

Thank you!
-Shaun

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-19 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found