Re: [pysnmp-users] PySNMP 4.3.1 strange prettyPrint() output
Brought to you by:
elie
From: Ilya E. <il...@gl...> - 2015-11-18 21:55:02
|
To troubleshoot the MIB compilation issue I’d advise: * Not a solution, but a quick cure: just run mibdump.py and collect compiled MIBs from where it stores them. I just checked, it works out-of-the-box pulling this and all required MIBs from web: $ mibdump.py AIRESPACE-WIRELESS-MIB * Make sure you are running the latest version of pysmi from pypi (0.0.7) * Enable pysmi debugging in your script and re-run your script to see where exactly it looks for MIB files: from pysmi import debug debug.setLogger(debug.Debug(‘reader')) There’s documentation on pysmi internals, but it may be too low level in this case: http://pysmi.sf.net -ilya > On 18 Nov 2015, at 22:25, Wei Wang <ww...@9r...> wrote: > > Ilya, > > Thanks for the response. > > I compiled the MIBs from their text files into the .py files (using the build-pysnmp-mib tool in a version 4.2.5 installation on a different host, if that matters). > > The text MIB files are here: > https://raw.githubusercontent.com/ww9rivers/SnmpMibs/master/cisco/AIRESPACE-WIRELESS-MIB.mib > https://raw.githubusercontent.com/ww9rivers/SnmpMibs/master/cisco/AIRESPACE-REF-MIB.mib > > I took the .py files out of the pysnmp folder and put it locally. Here is how I have loaded the MIB files: > > varbinds = [ > ObjectType( > #ObjectIdentity('.1.3.6.1.4.1.14179.2.2.1.1') > ObjectIdentity('AIRESPACE-WIRELESS-MIB', 'bsnAPEntry') > ) > .addMibSource(os.path.abspath('.')) > .loadMibs('AIRESPACE-REF-MIB', 'AIRESPACE-WIRELESS-MIB') > ] > > Of course, I only had the .py files there. That made the code resolve object names but produced the same SmiError. > > With your latest email, I try to get pysnmp to auto-compile the MIBs: > > mibs = 'file:///opt/nss/etc/snmp/mibs' > varbinds = [ > ObjectType( > #ObjectIdentity('.1.3.6.1.4.1.14179.2.2.1.1') > ObjectIdentity('AIRESPACE-WIRELESS-MIB', 'bsnAPEntry') > ) > .addAsn1MibSource(mibs, os.path.join(mibs, 'cisco')) > .loadMibs('AIRESPACE-REF-MIB', 'AIRESPACE-WIRELESS-MIB') > ] > > But I am getting this error: > > MibNotFoundError: AIRESPACE-WIRELESS-MIB compilation error(s): missing; no module "SNMPv2-TC" in symbolTable at MIB AIRESPACE-WIRELESS-MIB > > I do have these files locally: > /opt/nss/etc/snmp/mibs/cisco/AIRESPACE-WIRELESS-MIB.mib > /opt/nss/etc/snmp/mibs/cisco/AIRESPACE-REF-MIB.mib > /opt/nss/etc/snmp/mibs/SNMPv2-TC.mib > > Then there is also this: > /usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-TC.py > > Why is it complaining about (no module "SNMPv2-TC" in symbolTable at MIB AIRESPACE-WIRELESS-MIB)? > > Without much documentation, I am moving forward with trial-and-error here. What do I need to make the MIB compilation work? > > Thanks! |