Translating pysnmp oids to human readable strings

SpamMePlease PleasePlease spankthespam at googlemail.com
Sat Mar 7 17:23:45 CET 2009


On Fri, Mar 6, 2009 at 2:14 PM, Shantanu Joshi <weemadarthur at gmail.com> wrote:
>
> 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).
> --
> http://mail.python.org/mailman/listinfo/python-list
>

The thing is that I have copied the file (as you may see, I did 'ls
-lA' on it. If the file wasnt there, the error message was different.
Also, the setMibPath doesent seem to work, as I tried to set up it to
any value, and right after that I was performing getMibPath which was
giving me unchanged default paths. Keep in mind, that whole path setu
up code has executed without any error.
So, what is correct and working way to supply my code with that
converted mib file?

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



More information about the Python-list mailing list