[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-coders
Subject:    Re: All OIDs under a given root
From:       Wes Hardaker <hardaker () users ! sourceforge ! net>
Date:       2008-12-09 14:43:35
Message-ID: sdskox5rzc.fsf () wes ! hardakers ! net
[Download RAW message or body]

>>>>> On Tue, 09 Dec 2008 15:57:16 +1100, Adrian Overbury <adrian@inomial.com> said:

AO> Is there currently any interface (preferably in perl) that will allow me 
AO> to load a set of MIB files/modules into memory and, given a certain OID 
AO> root, tell which OID is next in that tree, or print out the entire
AO> tree?

The perl MIB interface is quite powerful.  See the SNMP module's
documentation for details.  In fact the mib2c program and its language
is written using it, which lets you do things like:

> cat test.conf
@open -@
@foreach $i scalar@
  Object: $i
    Syntax: $i.syntax
@end@

> mib2c -c test.conf system
writing to -
  Object: sysDescr
    Syntax: DisplayString
  Object: sysObjectID
    Syntax: OBJECTID
  Object: sysUpTime
    Syntax: TICKS
  Object: sysContact
    Syntax: DisplayString
...

AO> This would most likely exclude the indexes/rows of tables, because 
AO> they're not set things written into the MIB, but for single-value vars 
AO> that are part of the MIB, is there any possible way to do this?  I'm 
AO> just writing a pass_persist extension that could grow to cover a very 
AO> large subtree, so I'd prefer not to have to hardcode every OID it will 
AO> be responsible for.

You can use mib2c to also create most of the code automatically if you
want.  See the mib2c.conf manual page for details on writing input files
for it.
-- 
Wes Hardaker
Sparta, Inc.

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic