Translating pysnmp oids to human readable strings

SpamMePlease PleasePlease spankthespam at googlemail.com
Fri Mar 6 02:18:29 EST 2009


On Fri, Mar 6, 2009 at 6:56 AM, Shantanu Joshi <weemadarthur at gmail.com> wrote:
> You need to parse the MIB file to get the human-readable names
> corresponding to the OIDs. The pysnmp library already provides this
> functionality. I haven't used this feature myself (I mainly use pysnmp
> to automate SNMP walk requests, like the one in your code), but the
> documentation at found the below example at
> http://pysnmp.sourceforge.net/docs/4.1.x/index.html#MIB-SERVICES.
>
>
>>>> from pysnmp.smi import builder, view
>>>>
>>>> mibBuilder = builder.MibBuilder().loadModules('SNMPv2-MIB')
>>>> mibViewController = view.MibViewController(mibBuilder)
>>>>
>>>> oid,label,suffix = mibViewController.getNodeName((1,3,6,1,2,'mib-2',1,'sysDescr'))
>>>> print oid
> (1, 3, 6, 1, 2, 1, 1, 1)
>>>> print label
> ('iso', 'org', 'dod', 'internet', 'mgmt', 'mib-2', 'system', 'sysDescr')
>>>> print suffix
> ()
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Yes, I have seen that, but I cant get it working as expected (or it
doesent to what expected at all). I cant make it return values like:
jnxBgpM2PeerIdentifier.0.ipv4.38.101.161.119.1.38.101.161.118 (the one
of many I got from snmpwalk) but instead I am getting bunch of words
like iso, internet, mgmt, which is no way close to desired effect.
Still no luck - anybody with a clue?

-- 
--------------------
Spank The Spam!



More information about the Python-list mailing list