Translating pysnmp oids to human readable strings

Shantanu Joshi weemadarthur at gmail.com
Fri Mar 6 08:14:43 EST 2009


SpamMePlease PleasePlease <spankthespam at googlemail.com> writes:

>
> I actually tried to load the new file with following code:
>
> print builder.MibBuilder().getMibPath()
> mibBuilder = builder.MibBuilder().loadModules('jnx-bgpmib2')
>
> but I am experiencing the error:
>
> rivendell # python snmp.py
> ('/usr/lib/python2.4/site-packages/pysnmp/v4/smi/mibs/instances',
> '/usr/lib/python2.4/site-packages/pysnmp/v4/smi/mibs')
> Traceback (most recent call last):
>   File "snmp.py", line 7, in ?
>     mibBuilder = builder.MibBuilder().loadModules('jnx-bgpmib2')
>   File "//usr/lib/python2.4/site-packages/pysnmp/v4/smi/builder.py",
> line 82, in loadModules
>     raise error.SmiError(
> pysnmp.smi.error.SmiError: MIB module
> "/usr/lib/python2.4/site-packages/pysnmp/v4/smi/mibs/instances/jnx-bgpmib2.py"
> load error: MIB file ".py" not found in search path
> rivendell# ls -lA
> /usr/lib/python2.4/site-packages/pysnmp/v4/smi/mibs/instances/jnx-bgpmib2.py
> -rw-r--r-- 1 root root 2687 Mar  6 06:50
> /usr/lib/python2.4/site-packages/pysnmp/v4/smi/mibs/instances/jnx-bgpmib2.py
>
> Any clue what about is done wrong?

The pysnmp library is not able to find your generated file. Either copy
your generated file to /usr/lib/python2.4/site-packages/pysnmp/v4/smi/mibs/instances 
or call setMibPath on the mibBuilder instance before calling loadModules
to add the current directory (or whatever directory holds your generated
file).



More information about the Python-list mailing list