Re: [pysnmp-users] Custom MIB files
Brought to you by:
elie
From: Ilya E. <il...@gl...> - 2016-11-17 22:44:43
|
I could not compile your MIB because it seems to import both SMIv1 and SMIv2 types. Once I changed the SMIv1 IMPORTS: DisplayString FROM RFC1213-MIB for SMIv2 ones: DateAndTime, DisplayString, RowStatus, TruthValue, DisplayString FROM SNMPv2-TC It compiled successfully. As for your other question — your code looks OK for as long as you actually iterate the generator you’ve created because this is when actual I/O happens: gen = nextCmd(…) for rsp in gen: print(rsp) And SNMP agent at 169.254.81.145 is responding. You may also debug your script against public SNMP simulator: http://snmpsim.sourceforge.net/public-snmp-simulator.html Though it does not implement your MIB. > On 17 Nov 2016, at 22:18, Jian Li <ji...@le...> wrote: > > Ilya, > > Please find the attached MIB file. Thank you very much for your help. > > I was able to use mibdump.py to compile that MIB file to python modules. There is another question I want to ask you about pysnmp as well, I did not get any response for the following command, do I do something obviously wrong? The snmp agent is configured and I was able to get correct response for ObjectIdentity('SNMPv2-MIB', 'system') > > nextCmd(SnmpEngine(), > CommunityData('public', mpModel=1), > UdpTransportTarget(('169.254.81.145', 161)), > ContextData(), > ObjectType(ObjectIdentity(' PACKETPOWER-EG4-MIB, ' packetPower')) > > Thanks, > > Jian > > -----Original Message----- > From: Ilya Etingof [mailto:il...@gl...] > Sent: Thursday, November 17, 2016 3:08 PM > To: Jian Li > Cc: pys...@li... > Subject: Re: [pysnmp-users] Custom MIB files > > > Could you please share your MIB (e.g. CUSTOM-EG4-MIB)? I suspect it has syntax errors, in particular it may miss SNMPv2-SMI import. > >> On 15 Nov 2016, at 16:34, Jian Li <ji...@le...> wrote: >> >> I tried to add the MIB files to a python script, using PySNMP addAsn1MibSource(‘file:///path’). However I got the following error, >> >> pysnmp.smi.error.MibNotFoundError: CUSTOM-EG4-MIB compilation error(s): missing; missing; missing; missing; no module "SNMPv2-SMI" in symbolTable at MIB CUSTOM-EG4-MIB >> >> Would really appreciate your help to get it resolved. >> >> Thanks, >> >> Jian > <PACKETPOWER-EG4-MIB> |