Hello,

I'm working on a tool to generate configuration files for an internal 
application. This application uses OIDs to do its thing. However, humans aren't 
particularly good at reading pure OIDs, so I want to present the person running 
the tool with the MIB string (if found/known) while using the OID internally 
for what needs to be done.

I'm writing this in Python using the official Net-SNMP Python bindings. So far, 
I have not found a way to return *both* the MIB and the OID when doing a query.

My current pseudo-code looks like:

-----
import netsnmp
from os import popen

session = netsnmp.Session(Host, Version, Community)
session.UseLongNames = 1
session.UseNumeric = 1
session.UseEnums = 1
session.UseSprintValue = 1

vars = netsnmp.VarList(netsnmp.Varbind('system'))
foo = session.walk(vars)

for var in vars:
    mn = popen("/usr/bin/snmptranslate -M %s -Oq '%s'" % (mibdirs, var.tag))
    mib = mn.readline().strip()
    mn.close()
-----

This strikes me as extraordinarily inefficient and wasteful. It's also 
incredibly slow and kinda stupid. :-)

There must be a better way to get *both* the MIB and the OID returned from an 
SNMP walk. Am I missing something simple?

Thanks!

Thomas Knox  Apple Inc | IS Delivery | Office (408) 783-9063 | Cell (571) 
286-0814





------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to