pysnmp-users Mailing List for SNMP library for Python (Page 3)
Brought to you by:
elie
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(3) |
Mar
(16) |
Apr
(3) |
May
(6) |
Jun
|
Jul
(7) |
Aug
(12) |
Sep
(4) |
Oct
(2) |
Nov
(11) |
Dec
(6) |
2004 |
Jan
(1) |
Feb
(41) |
Mar
(4) |
Apr
(1) |
May
(6) |
Jun
|
Jul
(8) |
Aug
(5) |
Sep
(8) |
Oct
(10) |
Nov
(3) |
Dec
(1) |
2005 |
Jan
|
Feb
(4) |
Mar
(8) |
Apr
(4) |
May
(10) |
Jun
(5) |
Jul
(10) |
Aug
(6) |
Sep
(6) |
Oct
(39) |
Nov
(20) |
Dec
(21) |
2006 |
Jan
(14) |
Feb
(6) |
Mar
(15) |
Apr
|
May
(5) |
Jun
(16) |
Jul
(16) |
Aug
(18) |
Sep
(35) |
Oct
(12) |
Nov
(3) |
Dec
(3) |
2007 |
Jan
(12) |
Feb
(19) |
Mar
(27) |
Apr
(14) |
May
(32) |
Jun
|
Jul
(35) |
Aug
(11) |
Sep
(11) |
Oct
(6) |
Nov
(13) |
Dec
(4) |
2008 |
Jan
(7) |
Feb
(4) |
Mar
(2) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(5) |
Aug
(1) |
Sep
(2) |
Oct
(3) |
Nov
(19) |
Dec
(7) |
2009 |
Jan
(2) |
Feb
(2) |
Mar
(12) |
Apr
(16) |
May
(16) |
Jun
(23) |
Jul
(7) |
Aug
(2) |
Sep
(17) |
Oct
(20) |
Nov
(20) |
Dec
(5) |
2010 |
Jan
(11) |
Feb
(17) |
Mar
(20) |
Apr
(7) |
May
(6) |
Jun
(14) |
Jul
(5) |
Aug
(10) |
Sep
(23) |
Oct
(16) |
Nov
(32) |
Dec
(21) |
2011 |
Jan
(6) |
Feb
(11) |
Mar
(3) |
Apr
(1) |
May
(4) |
Jun
(1) |
Jul
(4) |
Aug
(8) |
Sep
(20) |
Oct
(9) |
Nov
(29) |
Dec
(25) |
2012 |
Jan
(2) |
Feb
(5) |
Mar
(2) |
Apr
(22) |
May
(21) |
Jun
(7) |
Jul
(6) |
Aug
(2) |
Sep
(12) |
Oct
(20) |
Nov
(17) |
Dec
(17) |
2013 |
Jan
(4) |
Feb
(4) |
Mar
(8) |
Apr
(8) |
May
(10) |
Jun
(2) |
Jul
(23) |
Aug
(12) |
Sep
(14) |
Oct
(12) |
Nov
(4) |
Dec
(18) |
2014 |
Jan
(2) |
Feb
(7) |
Mar
(3) |
Apr
(8) |
May
(7) |
Jun
(1) |
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(1) |
2015 |
Jan
(3) |
Feb
(15) |
Mar
(14) |
Apr
(4) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(6) |
Sep
(5) |
Oct
(21) |
Nov
(43) |
Dec
(10) |
2016 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(4) |
May
(6) |
Jun
(2) |
Jul
(6) |
Aug
(5) |
Sep
(4) |
Oct
|
Nov
(3) |
Dec
(11) |
2017 |
Jan
(1) |
Feb
(8) |
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
(9) |
Oct
(8) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Ilya E. <il...@gl...> - 2016-12-15 11:40:22
|
Looking at VM-MIB, I do not see vmNumber object there: http://mibs.snmplabs.com/asn1/VM-MIB Do you have a newer MIB? Also, given you query an existing object, you should query MIB object rather than MIB object instance: ObjectType(ObjectIdentity('VM-MIB', 'vmNumber', 0).addAsn1MibSource('file:///usr/share/snmp', 'http://mibs.snmplabs.com/asn1/@mib@'))) On 12/15/2016 12:17 PM, riv...@wi... wrote: > Hi, > > > > I have tried this below one. > > > > #!/usr/bin/python > > from pysnmp.hlapi import * > > > > errorIndication, errorStatus, errorIndex, varBinds = next( > > getCmd(SnmpEngine(), > > CommunityData('public'), > > UdpTransportTarget(('10.154.19.88', 161)), > > ContextData(), > > ObjectType(ObjectIdentity('VM-MIB', > 'vmNumber').addAsn1MibSource('file:///usr/share/snmp', > > > 'http://mibs.snmplabs.com/asn1/@mib@'))) > > ) > > > > if errorIndication: > > print(errorIndication) > > elif errorStatus: > > print('%s at %s' % (errorStatus.prettyPrint(), > > errorIndex and varBinds[int(errorIndex) - 1][0] > or '?')) > > else: > > for varBind in varBinds: > > print(' = '.join([x.prettyPrint() for x in varBind])) > > > > > > VM-MIB::vmNumber = No Such Object currently exists at this OID > > > > Thanks & Regards, > > Riva. > > > > *From:*Rivarani Roy > *Sent:* Thursday, December 15, 2016 3:48 PM > *To:* 'Ilya Etingof' <il...@gl...> > *Cc:* pys...@li... > *Subject:* RE: [pysnmp-users] Problem observed in new mib loading > > > > Hi, > > > > I followed the below steps but got the same result. > > Currently using the latest pysnmp but didn’t get any success. > > > > Thanks & Regards, > > Riva. > > > > *From:*Ilya Etingof [mailto:il...@gl...] > *Sent:* Thursday, December 15, 2016 2:26 PM > *To:* Rivarani Roy <riv...@wi... <mailto:riv...@wi...>> > *Cc:* pys...@li... > <mailto:pys...@li...> > *Subject:* Re: [pysnmp-users] Problem observed in new mib loading > > > > ** This mail has been sent from an external source ** > > Try adding `lookupNames=True`, `lookupValues=True` as shown here: > > > > > http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/getnext-v2c-with-mib-resolution.html > > > > But even better upgrade to the latest pysnmp and you could skip the > explicit mibdump-based conversion step. > > > > > http://pysnmp.sourceforge.net/examples/hlapi/asyncore/sync/manager/cmdgen/walking-operations.html > > > > > > On 15 Dec 2016, at 07:11, <riv...@wi... > <mailto:riv...@wi...>> <riv...@wi... > <mailto:riv...@wi...>> wrote: > > > > Hi, > > > > I am trying to automate VM-MIB by using pysnmp. > > > > 1. Generated VM-MIB.py file from VM-MIB.txt by mibdump.py > --debug=all --mib-borrower=/usr/share/snmp/mibs/ VM-MIB.txt > > 2. Tried loadmib and addmibsource modules to load VM-MIB. > > > > Its loading the Object from VM-MIB as I am able to see the output > but the MIB name is showing as SNMPv2-SMI. > > Is it the right procedure to do or do we have any other process. > > > > #!/usr/bin/python > > from pysnmp.entity.rfc3413.oneliner import cmdgen > > > > cmdGen = cmdgen.CommandGenerator() > > > > errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd( > > cmdgen.CommunityData('public'), > > cmdgen.UdpTransportTarget(('10.154.19.88', 161)), > > #cmdgen.MibVariable('VM-MIB', 'vmEntry').loadmibs(), > > lexicographicMode=True, maxRows=100, > > ignoreNonIncreasingOid=True > > ) > > #print varBindTable > > > > # Check for errors and print out results > > if errorIndication: > > print(errorIndication) > > else: > > if errorStatus: > > print('%s at %s' % ( > > errorStatus.prettyPrint(), > > errorIndex and varBindTable[int(errorIndex)-1] or '?' > > ) > > ) > > else: > > #for name, val in varBindTable: > > #print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) > > #print (varBindTable[0][0].prettyPrint() +' = '+ > varBindTable[0][1].prettyPrint()) > > len_value= len(varBindTable) > > output = open('template.txt','a') > > for i in range(0,len_value): > > output.write(varBindTable[i][0].prettyPrint()) > > output.write("\n") > > output.close() > > > > > > > > Getting this below output. > > > > > > SNMPv2-SMI::mib-2.23456.1.4.1.2.2 = VM6 ----------- it should > represent as VM-MIB instead of SNMPV2-SMI > > SNMPv2-SMI::mib-2.23456.1.4.1.2.3 = VM1 > > SNMPv2-SMI::mib-2.23456.1.4.1.2.4 = VM2 > > SNMPv2-SMI::mib-2.23456.1.4.1.2.5 = VM3 > > SNMPv2-SMI::mib-2.23456.1.4.1.2.6 = VM4 > > > > > > > > Thanks & Regards, > > Riva. > |
From: <riv...@wi...> - 2016-12-15 11:17:31
|
Hi, I have tried this below one. #!/usr/bin/python from pysnmp.hlapi import * errorIndication, errorStatus, errorIndex, varBinds = next( getCmd(SnmpEngine(), CommunityData('public'), UdpTransportTarget(('10.154.19.88', 161)), ContextData(), ObjectType(ObjectIdentity('VM-MIB', 'vmNumber').addAsn1MibSource('file:///usr/share/snmp', 'http://mibs.snmplabs.com/asn1/@mib@'))) ) if errorIndication: print(errorIndication) elif errorStatus: print('%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) else: for varBind in varBinds: print(' = '.join([x.prettyPrint() for x in varBind])) VM-MIB::vmNumber = No Such Object currently exists at this OID Thanks & Regards, Riva. From: Rivarani Roy Sent: Thursday, December 15, 2016 3:48 PM To: 'Ilya Etingof' <il...@gl...> Cc: pys...@li... Subject: RE: [pysnmp-users] Problem observed in new mib loading Hi, I followed the below steps but got the same result. Currently using the latest pysnmp but didn't get any success. Thanks & Regards, Riva. From: Ilya Etingof [mailto:il...@gl...] Sent: Thursday, December 15, 2016 2:26 PM To: Rivarani Roy <riv...@wi...<mailto:riv...@wi...>> Cc: pys...@li...<mailto:pys...@li...> Subject: Re: [pysnmp-users] Problem observed in new mib loading ** This mail has been sent from an external source ** Try adding `lookupNames=True`, `lookupValues=True` as shown here: http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/getnext-v2c-with-mib-resolution.html But even better upgrade to the latest pysnmp and you could skip the explicit mibdump-based conversion step. http://pysnmp.sourceforge.net/examples/hlapi/asyncore/sync/manager/cmdgen/walking-operations.html On 15 Dec 2016, at 07:11, <riv...@wi...<mailto:riv...@wi...>> <riv...@wi...<mailto:riv...@wi...>> wrote: Hi, I am trying to automate VM-MIB by using pysnmp. 1. Generated VM-MIB.py file from VM-MIB.txt by mibdump.py --debug=all --mib-borrower=/usr/share/snmp/mibs/ VM-MIB.txt 2. Tried loadmib and addmibsource modules to load VM-MIB. Its loading the Object from VM-MIB as I am able to see the output but the MIB name is showing as SNMPv2-SMI. Is it the right procedure to do or do we have any other process. #!/usr/bin/python from pysnmp.entity.rfc3413.oneliner import cmdgen cmdGen = cmdgen.CommandGenerator() errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd( cmdgen.CommunityData('public'), cmdgen.UdpTransportTarget(('10.154.19.88', 161)), #cmdgen.MibVariable('VM-MIB', 'vmEntry').loadmibs(), lexicographicMode=True, maxRows=100, ignoreNonIncreasingOid=True ) #print varBindTable # Check for errors and print out results if errorIndication: print(errorIndication) else: if errorStatus: print('%s at %s' % ( errorStatus.prettyPrint(), errorIndex and varBindTable[int(errorIndex)-1] or '?' ) ) else: #for name, val in varBindTable: #print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) #print (varBindTable[0][0].prettyPrint() +' = '+ varBindTable[0][1].prettyPrint()) len_value= len(varBindTable) output = open('template.txt','a') for i in range(0,len_value): output.write(varBindTable[i][0].prettyPrint()) output.write("\n") output.close() Getting this below output. SNMPv2-SMI::mib-2.23456.1.4.1.2.2 = VM6 ----------- it should represent as VM-MIB instead of SNMPV2-SMI SNMPv2-SMI::mib-2.23456.1.4.1.2.3 = VM1 SNMPv2-SMI::mib-2.23456.1.4.1.2.4 = VM2 SNMPv2-SMI::mib-2.23456.1.4.1.2.5 = VM3 SNMPv2-SMI::mib-2.23456.1.4.1.2.6 = VM4 Thanks & Regards, Riva. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com |
From: <riv...@wi...> - 2016-12-15 10:17:47
|
Hi, I followed the below steps but got the same result. Currently using the latest pysnmp but didn't get any success. Thanks & Regards, Riva. From: Ilya Etingof [mailto:il...@gl...] Sent: Thursday, December 15, 2016 2:26 PM To: Rivarani Roy <riv...@wi...> Cc: pys...@li... Subject: Re: [pysnmp-users] Problem observed in new mib loading ** This mail has been sent from an external source ** Try adding `lookupNames=True`, `lookupValues=True` as shown here: http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/getnext-v2c-with-mib-resolution.html But even better upgrade to the latest pysnmp and you could skip the explicit mibdump-based conversion step. http://pysnmp.sourceforge.net/examples/hlapi/asyncore/sync/manager/cmdgen/walking-operations.html On 15 Dec 2016, at 07:11, <riv...@wi...<mailto:riv...@wi...>> <riv...@wi...<mailto:riv...@wi...>> wrote: Hi, I am trying to automate VM-MIB by using pysnmp. 1. Generated VM-MIB.py file from VM-MIB.txt by mibdump.py --debug=all --mib-borrower=/usr/share/snmp/mibs/ VM-MIB.txt 2. Tried loadmib and addmibsource modules to load VM-MIB. Its loading the Object from VM-MIB as I am able to see the output but the MIB name is showing as SNMPv2-SMI. Is it the right procedure to do or do we have any other process. #!/usr/bin/python from pysnmp.entity.rfc3413.oneliner import cmdgen cmdGen = cmdgen.CommandGenerator() errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd( cmdgen.CommunityData('public'), cmdgen.UdpTransportTarget(('10.154.19.88', 161)), #cmdgen.MibVariable('VM-MIB', 'vmEntry').loadmibs(), lexicographicMode=True, maxRows=100, ignoreNonIncreasingOid=True ) #print varBindTable # Check for errors and print out results if errorIndication: print(errorIndication) else: if errorStatus: print('%s at %s' % ( errorStatus.prettyPrint(), errorIndex and varBindTable[int(errorIndex)-1] or '?' ) ) else: #for name, val in varBindTable: #print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) #print (varBindTable[0][0].prettyPrint() +' = '+ varBindTable[0][1].prettyPrint()) len_value= len(varBindTable) output = open('template.txt','a') for i in range(0,len_value): output.write(varBindTable[i][0].prettyPrint()) output.write("\n") output.close() Getting this below output. SNMPv2-SMI::mib-2.23456.1.4.1.2.2 = VM6 ----------- it should represent as VM-MIB instead of SNMPV2-SMI SNMPv2-SMI::mib-2.23456.1.4.1.2.3 = VM1 SNMPv2-SMI::mib-2.23456.1.4.1.2.4 = VM2 SNMPv2-SMI::mib-2.23456.1.4.1.2.5 = VM3 SNMPv2-SMI::mib-2.23456.1.4.1.2.6 = VM4 Thanks & Regards, Riva. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com |
From: Ilya E. <il...@gl...> - 2016-12-15 08:56:23
|
Try adding `lookupNames=True`, `lookupValues=True` as shown here: http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/getnext-v2c-with-mib-resolution.html <http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/getnext-v2c-with-mib-resolution.html> But even better upgrade to the latest pysnmp and you could skip the explicit mibdump-based conversion step. http://pysnmp.sourceforge.net/examples/hlapi/asyncore/sync/manager/cmdgen/walking-operations.html <http://pysnmp.sourceforge.net/examples/hlapi/asyncore/sync/manager/cmdgen/walking-operations.html> > On 15 Dec 2016, at 07:11, <riv...@wi...> <riv...@wi...> wrote: > > Hi, > > I am trying to automate VM-MIB by using pysnmp. > > 1. Generated VM-MIB.py file from VM-MIB.txt by mibdump.py --debug=all --mib-borrower=/usr/share/snmp/mibs/ VM-MIB.txt > 2. Tried loadmib and addmibsource modules to load VM-MIB. > > Its loading the Object from VM-MIB as I am able to see the output but the MIB name is showing as SNMPv2-SMI. > Is it the right procedure to do or do we have any other process. > > #!/usr/bin/python > from pysnmp.entity.rfc3413.oneliner import cmdgen > > cmdGen = cmdgen.CommandGenerator() > > errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd( > cmdgen.CommunityData('public'), > cmdgen.UdpTransportTarget(('10.154.19.88', 161)), > #cmdgen.MibVariable('VM-MIB', 'vmEntry').loadmibs(), > lexicographicMode=True, maxRows=100, > ignoreNonIncreasingOid=True > ) > #print varBindTable > > # Check for errors and print out results > if errorIndication: > print(errorIndication) > else: > if errorStatus: > print('%s at %s' % ( > errorStatus.prettyPrint(), > errorIndex and varBindTable[int(errorIndex)-1] or '?' > ) > ) > else: > #for name, val in varBindTable: > #print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) > #print (varBindTable[0][0].prettyPrint() +' = '+ varBindTable[0][1].prettyPrint()) > len_value= len(varBindTable) > output = open('template.txt','a') > for i in range(0,len_value): > output.write(varBindTable[i][0].prettyPrint()) > output.write("\n") > output.close() > > > > Getting this below output. > > > SNMPv2-SMI::mib-2.23456.1.4.1.2.2 = VM6 ----------- it should represent as VM-MIB instead of SNMPV2-SMI > SNMPv2-SMI::mib-2.23456.1.4.1.2.3 = VM1 > SNMPv2-SMI::mib-2.23456.1.4.1.2.4 = VM2 > SNMPv2-SMI::mib-2.23456.1.4.1.2.5 = VM3 > SNMPv2-SMI::mib-2.23456.1.4.1.2.6 = VM4 > > > > Thanks & Regards, > Riva. |
From: <riv...@wi...> - 2016-12-15 06:27:19
|
Hi, I am trying to automate VM-MIB by using pysnmp. 1. Generated VM-MIB.py file from VM-MIB.txt by mibdump.py --debug=all --mib-borrower=/usr/share/snmp/mibs/ VM-MIB.txt 2. Tried loadmib and addmibsource modules to load VM-MIB. Its loading the Object from VM-MIB as I am able to see the output but the MIB name is showing as SNMPv2-SMI. Is it the right procedure to do or do we have any other process. #!/usr/bin/python from pysnmp.entity.rfc3413.oneliner import cmdgen cmdGen = cmdgen.CommandGenerator() errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd( cmdgen.CommunityData('public'), cmdgen.UdpTransportTarget(('10.154.19.88', 161)), #cmdgen.MibVariable('VM-MIB', 'vmEntry').loadmibs(), lexicographicMode=True, maxRows=100, ignoreNonIncreasingOid=True ) #print varBindTable # Check for errors and print out results if errorIndication: print(errorIndication) else: if errorStatus: print('%s at %s' % ( errorStatus.prettyPrint(), errorIndex and varBindTable[int(errorIndex)-1] or '?' ) ) else: #for name, val in varBindTable: #print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) #print (varBindTable[0][0].prettyPrint() +' = '+ varBindTable[0][1].prettyPrint()) len_value= len(varBindTable) output = open('template.txt','a') for i in range(0,len_value): output.write(varBindTable[i][0].prettyPrint()) output.write("\n") output.close() Getting this below output. SNMPv2-SMI::mib-2.23456.1.4.1.2.2 = VM6 ----------- it should represent as VM-MIB instead of SNMPV2-SMI SNMPv2-SMI::mib-2.23456.1.4.1.2.3 = VM1 SNMPv2-SMI::mib-2.23456.1.4.1.2.4 = VM2 SNMPv2-SMI::mib-2.23456.1.4.1.2.5 = VM3 SNMPv2-SMI::mib-2.23456.1.4.1.2.6 = VM4 Thanks & Regards, Riva. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com |
From: Jian Li <ji...@le...> - 2016-12-05 21:46:04
|
Ilya, So PacketPower actually put the MIB file on-line? I am fine to use the local file option for now, and wait for them to get it updated online. The local file option worked for me. Now I see the modifications in the python file. Thanks a lot for your help. Thanks, Jian -----Original Message----- From: Ilya Etingof [mailto:il...@gl...] Sent: Monday, December 5, 2016 3:58 PM To: Jian Li Cc: pys...@li... Subject: Re: [pysnmp-users] Custom MIB files Jian, I can replace the on-line version of the MIB file if it is somehow outdated or broken. If you want to use an alternative version locally, just point `mibdump` to your local directory by passing the: --mib-source file:///local-directory --mib-source 'http://mibs.snmplabs.com/asn1/@mib@' option to it. The second --mib-source may be needed for `mibdump` to pick up dependent MIBs from the web server if you do not have them locally. On 12/05/2016 09:50 PM, Jian Li wrote: > Ilya, > > Some more info for the mibdump.py issue I am experiencing. > > This is the MIB I am trying to modify with a local MIB text file, > /mibs.snmplabs.com/asn1/PACKETPOWER-EG4-MIB/. > When I do /mibdump.py > --rebuild///local-directory/PACKKETPOWER-EG4-MIB.txt/ it always takes > the content from the online PACKETPOWER-EG4-MIB without any > modifications in my local MIB text file ( I was trying to add more > constraint values for channelId in that file) to the generated > ~/.pysnmp/mibs/PACKETPOWER-EG4-MIB.py > > So, how did /PACKETPOWER-EG4-MI/ get online? Is it possible to either > delete or modify it? > > Thanks, > > Jian > > -----Original Message----- > From: Ilya Etingof [mailto:il...@gl...] > Sent: Saturday, December 3, 2016 7:39 AM > To: Jian Li > Cc: pys...@li...<mailto:pys...@li...> > Subject: Re: [pysnmp-users] Custom MIB files > > > My guess is that once you compiled MIB into .py form, you should make > pysnmp using it by either: > > * moving your .py MIB into ~/.pysnmp/mibs or > * configuring pysnmp to pick up .py MIBs from a non-default location > (http://pysnmp.sourceforge.net/docs/api-reference.html#pysnmp.smi.rfc1902.ObjectIdentity.addMibSource). > > MIB files at snmplabs.com serve as a shared, community repository of > originally ASN.1 MIB files, there should be no need to remove them. > >> On 02 Dec 2016, at 22:41, Jian Li <ji...@le... <mailto:ji...@le...<mailto:ji...@le...%20<mailto:ji...@le...>>> wrote: >> >> Ilya, >> >> I modified my mib file and did a "mibdump.py --rebuild" with the >> modified mib file. But the generated python file did not take the >> modifications ( I am using ubuntu14.04 with python 2.7). Do I need to >> somehow delete the one online as well, >> http://mibs.snmplabs.com:80/asn1/PACKETPOWER-EG4-MIB >> >> Thanks, >> >> Jian >> >> -----Original Message----- >> From: Ilya Etingof [mailto:il...@gl...] >> Sent: Thursday, November 17, 2016 5:45 PM >> To: Jian Li >> Cc: pys...@li...<mailto:pys...@li...> > <mailto:pys...@li...> >> Subject: Re: [pysnmp-users] Custom MIB files >> >> >> 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... <mailto:ji...@le...<mailto:ji...@le...%20<mailto: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...<mailto:pys...@li...> > <mailto: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... <mailto:ji...@le...<mailto:ji...@le...%20<mailto: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> >> > > |
From: Ilya E. <il...@gl...> - 2016-12-05 20:58:10
|
Jian, I can replace the on-line version of the MIB file if it is somehow outdated or broken. If you want to use an alternative version locally, just point `mibdump` to your local directory by passing the: --mib-source file:///local-directory --mib-source 'http://mibs.snmplabs.com/asn1/@mib@' option to it. The second --mib-source may be needed for `mibdump` to pick up dependent MIBs from the web server if you do not have them locally. On 12/05/2016 09:50 PM, Jian Li wrote: > Ilya, > > Some more info for the mibdump.py issue I am experiencing. > > This is the MIB I am trying to modify with a local MIB text file, > /mibs.snmplabs.com/asn1/PACKETPOWER-EG4-MIB/. > When I do /mibdump.py > --rebuild///local-directory/PACKKETPOWER-EG4-MIB.txt/ it always takes > the content from the online PACKETPOWER-EG4-MIB without any > modifications in my local MIB text file ( I was trying to add more > constraint values for channelId in that file) to the generated > ~/.pysnmp/mibs/PACKETPOWER-EG4-MIB.py > > So, how did /PACKETPOWER-EG4-MI/ get online? Is it possible to either > delete or modify it? > > Thanks, > > Jian > > -----Original Message----- > From: Ilya Etingof [mailto:il...@gl...] > Sent: Saturday, December 3, 2016 7:39 AM > To: Jian Li > Cc: pys...@li... > Subject: Re: [pysnmp-users] Custom MIB files > > > My guess is that once you compiled MIB into .py form, you should make > pysnmp using it by either: > > * moving your .py MIB into ~/.pysnmp/mibs or > * configuring pysnmp to pick up .py MIBs from a non-default location > (http://pysnmp.sourceforge.net/docs/api-reference.html#pysnmp.smi.rfc1902.ObjectIdentity.addMibSource). > > MIB files at snmplabs.com serve as a shared, community repository of > originally ASN.1 MIB files, there should be no need to remove them. > >> On 02 Dec 2016, at 22:41, Jian Li <ji...@le... <mailto:ji...@le...>> wrote: >> >> Ilya, >> >> I modified my mib file and did a "mibdump.py --rebuild" with the >> modified mib file. But the generated python file did not take the >> modifications ( I am using ubuntu14.04 with python 2.7). Do I need to >> somehow delete the one online as well, >> http://mibs.snmplabs.com:80/asn1/PACKETPOWER-EG4-MIB >> >> Thanks, >> >> Jian >> >> -----Original Message----- >> From: Ilya Etingof [mailto:il...@gl...] >> Sent: Thursday, November 17, 2016 5:45 PM >> To: Jian Li >> Cc: pys...@li... > <mailto:pys...@li...> >> Subject: Re: [pysnmp-users] Custom MIB files >> >> >> 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... <mailto: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... > <mailto: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... <mailto: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> >> > > |
From: Jian Li <ji...@le...> - 2016-12-05 20:50:48
|
Ilya, Some more info for the mibdump.py issue I am experiencing. This is the MIB I am trying to modify with a local MIB text file, mibs.snmplabs.com/asn1/PACKETPOWER-EG4-MIB. When I do mibdump.py --rebuild /local-directory/PACKKETPOWER-EG4-MIB.txt it always takes the content from the online PACKETPOWER-EG4-MIB without any modifications in my local MIB text file ( I was trying to add more constraint values for channelId in that file) to the generated ~/.pysnmp/mibs/PACKETPOWER-EG4-MIB.py So, how did PACKETPOWER-EG4-MI get online? Is it possible to either delete or modify it? Thanks, Jian -----Original Message----- From: Ilya Etingof [mailto:il...@gl...] Sent: Saturday, December 3, 2016 7:39 AM To: Jian Li Cc: pys...@li... Subject: Re: [pysnmp-users] Custom MIB files My guess is that once you compiled MIB into .py form, you should make pysnmp using it by either: * moving your .py MIB into ~/.pysnmp/mibs or * configuring pysnmp to pick up .py MIBs from a non-default location (http://pysnmp.sourceforge.net/docs/api-reference.html#pysnmp.smi.rfc1902.ObjectIdentity.addMibSource). MIB files at snmplabs.com serve as a shared, community repository of originally ASN.1 MIB files, there should be no need to remove them. > On 02 Dec 2016, at 22:41, Jian Li <ji...@le...<mailto:ji...@le...>> wrote: > > Ilya, > > I modified my mib file and did a "mibdump.py --rebuild" with the > modified mib file. But the generated python file did not take the > modifications ( I am using ubuntu14.04 with python 2.7). Do I need to > somehow delete the one online as well, > http://mibs.snmplabs.com:80/asn1/PACKETPOWER-EG4-MIB > > Thanks, > > Jian > > -----Original Message----- > From: Ilya Etingof [mailto:il...@gl...] > Sent: Thursday, November 17, 2016 5:45 PM > To: Jian Li > Cc: pys...@li...<mailto:pys...@li...> > Subject: Re: [pysnmp-users] Custom MIB files > > > 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...<mailto: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...<mailto: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...<mailto: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> > |
From: Jian Li <ji...@le...> - 2016-12-05 15:25:14
|
Ilya, It's a very wired issue. Maybe I am missing something very simple. This is what I did, 1. Modify THE-MIB 2. Delete THE-MIB.py and THE-MIB.pyc under ~/.pysnmp/mibs 3. mibdump.py --rebuild THE-MIB 4. THE-MIB.py and THE-MIB.pyc got generated under ~/.pysnmp/mibs. However, when I open MY-MIB.py the modification is not there. The modification is rather simple, just add more values on INTEGER constraints, SYNTAX INTEGER { voltage ( 1 ) , current ( 2 ) , more (3) } It appears that the online one got copied to my local directory again? Thanks, Jian -----Original Message----- From: Ilya Etingof [mailto:il...@gl...] Sent: Saturday, December 3, 2016 7:39 AM To: Jian Li Cc: pys...@li... Subject: Re: [pysnmp-users] Custom MIB files My guess is that once you compiled MIB into .py form, you should make pysnmp using it by either: * moving your .py MIB into ~/.pysnmp/mibs or * configuring pysnmp to pick up .py MIBs from a non-default location (http://pysnmp.sourceforge.net/docs/api-reference.html#pysnmp.smi.rfc1902.ObjectIdentity.addMibSource). MIB files at snmplabs.com serve as a shared, community repository of originally ASN.1 MIB files, there should be no need to remove them. > On 02 Dec 2016, at 22:41, Jian Li <ji...@le...> wrote: > > Ilya, > > I modified my mib file and did a "mibdump.py --rebuild" with the > modified mib file. But the generated python file did not take the > modifications ( I am using ubuntu14.04 with python 2.7). Do I need to > somehow delete the one online as well, > http://mibs.snmplabs.com:80/asn1/PACKETPOWER-EG4-MIB > > Thanks, > > Jian > > -----Original Message----- > From: Ilya Etingof [mailto:il...@gl...] > Sent: Thursday, November 17, 2016 5:45 PM > To: Jian Li > Cc: pys...@li... > Subject: Re: [pysnmp-users] Custom MIB files > > > 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> > |
From: Ilya E. <il...@gl...> - 2016-12-03 12:38:56
|
My guess is that once you compiled MIB into .py form, you should make pysnmp using it by either: * moving your .py MIB into ~/.pysnmp/mibs or * configuring pysnmp to pick up .py MIBs from a non-default location (http://pysnmp.sourceforge.net/docs/api-reference.html#pysnmp.smi.rfc1902.ObjectIdentity.addMibSource). MIB files at snmplabs.com serve as a shared, community repository of originally ASN.1 MIB files, there should be no need to remove them. > On 02 Dec 2016, at 22:41, Jian Li <ji...@le...> wrote: > > Ilya, > > I modified my mib file and did a "mibdump.py --rebuild" with the modified mib file. But the generated python file did not take the modifications ( I am using ubuntu14.04 with python 2.7). Do I need to somehow delete the one online as well, > http://mibs.snmplabs.com:80/asn1/PACKETPOWER-EG4-MIB > > Thanks, > > Jian > > -----Original Message----- > From: Ilya Etingof [mailto:il...@gl...] > Sent: Thursday, November 17, 2016 5:45 PM > To: Jian Li > Cc: pys...@li... > Subject: Re: [pysnmp-users] Custom MIB files > > > 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> > |
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> |
From: Ilya E. <il...@gl...> - 2016-11-17 20:08:00
|
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 |
From: Jian Li <ji...@le...> - 2016-11-15 15:36:17
|
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 |
From: Clive T. <cl...@sw...> - 2016-09-19 08:54:59
|
Many thanks for the advice. As it looked like a Python version problem (I use Python 3.4), I reinstalled, but this time being careful to use pip3.4. All is well now! Thanks again, Clive From: Ilya Etingof [mailto:il...@gl...] Sent: 16 September 2016 23:09 To: Clive Tomlinson <cl...@sw...> Cc: pys...@li... Subject: Re: [pysnmp-users] Python 3 apparent compatibility problem Hi Clive, The pysnmp library definitely works with Python 3.4 on Linux and OS X. To troubleshoot your issue please provide the whole traceback and the script you are running. Also make sure you are running the latest pyasn1 version. Finally, if nothing helps, try running pysnmp with its internal debugging enables — that would pinpoint the step where exception occurs. On 16 Sep 2016, at 16:12, Clive Tomlinson <cl...@sw...<mailto:cl...@sw...>> wrote: Hello I’m trying to get PySNMP 4.3.2 working with Python 3.4, on a Windows PC using the Pycharm IDE. I started by copying some example code from the PySNMP page on sourceforge. Its first line was from pysnmp.hlapi import * That import caused a load of errors when I attempted to run it. Here’s an example: File "C:\Users\clive\AppData\Roaming\Python\Python34\site-packages\pysnmp\proto\rfc1902.py", line 25 constraints.ValueRangeConstraint(-2147483648L, 2147483647L), As the ‘L’ suffix has been removed in Python 3, it looks like there’s a compatibility problem. Yet people say that PySNMP works with Python up to 3.5. I’m very puzzled, and will welcome any help. Thanks Clive |
From: Ilya E. <il...@gl...> - 2016-09-16 22:09:23
|
Hi Clive, The pysnmp library definitely works with Python 3.4 on Linux and OS X. To troubleshoot your issue please provide the whole traceback and the script you are running. Also make sure you are running the latest pyasn1 version. Finally, if nothing helps, try running pysnmp with its internal debugging enables — that would pinpoint the step where exception occurs. > On 16 Sep 2016, at 16:12, Clive Tomlinson <cl...@sw...> wrote: > > Hello > I’m trying to get PySNMP 4.3.2 working with Python 3.4, on a Windows PC using the Pycharm IDE. > I started by copying some example code from the PySNMP page on sourceforge. Its first line was > from pysnmp.hlapi import * > That import caused a load of errors when I attempted to run it. Here’s an example: > File "C:\Users\clive\AppData\Roaming\Python\Python34\site-packages\pysnmp\proto\rfc1902.py", line 25 > constraints.ValueRangeConstraint(-2147483648L, 2147483647L), > As the ‘L’ suffix has been removed in Python 3, it looks like there’s a compatibility problem. > Yet people say that PySNMP works with Python up to 3.5. > I’m very puzzled, and will welcome any help. > Thanks > Clive |
From: Clive T. <cl...@sw...> - 2016-09-16 14:44:47
|
Hello I'm trying to get PySNMP 4.3.2 working with Python 3.4, on a Windows PC using the Pycharm IDE. I started by copying some example code from the PySNMP page on sourceforge. Its first line was from pysnmp.hlapi import * That import caused a load of errors when I attempted to run it. Here's an example: File "C:\Users\clive\AppData\Roaming\Python\Python34\site-packages\pysnmp\proto\rfc1902.py", line 25 constraints.ValueRangeConstraint(-2147483648L, 2147483647L), As the 'L' suffix has been removed in Python 3, it looks like there's a compatibility problem. Yet people say that PySNMP works with Python up to 3.5. I'm very puzzled, and will welcome any help. Thanks Clive |
From: Ilya E. <il...@gl...> - 2016-09-09 00:36:51
|
Hi Graham, As for #1, the sync version has some logic in place to produce a well-formed response table from possibly excessive data served by the agent. That additional code is here: https://github.com/etingof/pysnmp/blob/master/pysnmp/hlapi/asyncore/sync/cmdgen.py#L572 <https://github.com/etingof/pysnmp/blob/master/pysnmp/hlapi/asyncore/sync/cmdgen.py#L572> To keep next/bulk command generator going, your callback function should return True. But it should do it conditionally — when, after looking into response table, your code considers the whole table it fetched, it should return False to terminate the iteration. Alternatively, you can always issue single queries (by returning False from the callback) for as long as you want more data, by initiating next/bulk iteration right from the callback or a loop. The second approach is taken in the sync version: https://github.com/etingof/pysnmp/blob/master/examples/v3arch/asyncore/manager/cmdgen/getbulk-multiple-oids-to-eom.py#L67 <https://github.com/etingof/pysnmp/blob/master/examples/v3arch/asyncore/manager/cmdgen/getbulk-multiple-oids-to-eom.py#L67> I would not recommend descending to the “native API level” as it is way more detailed and does solve neither of the issues you mention. I’d probably experiment with borrowing a piece of relevant code from the sync version and putting it into your callback to strip excessive rows and stop when table is done. If you end up isolating the above code into a reusable subroutine, I’d welcome your PR. ;) > On 23 Aug 2016, at 14:42, Graham Hudspith <gr...@ze...> wrote: > > Hi All, > > I've a python+pySNMP script querying an agent using the hlapi (synchronous) api and I want to switch it to using the hlapi.asyncore api instead. > > This is with version 4.3.2 and using bulkCmd(). > > To do this I had to move most of my code into a callback function, create a cbCtx object to pass in a dict to store the results into and then call the snmp-engine's transport dispatcher. > > I've come across two problems: > > Since the hlapi.asyncore version of bulkCmd() does not seem to support the "lexicographicMode=False" option, I now get "extra" results returned when the data in the asked-for table runs out. Sometimes this contains entries for "columns" in the table that I have *not* asked for, sometimes it contains "columns" from "rows" in the next table > My callback seems to be called only once per query, so if the table is larger than the number of rows that will fit in one response, the code does not issue a new request and my results are truncated. My callback does not return a value, but if I add a "return True" to the end, it seems to loop forever, including many, many, results from beyond the end of the asked-for table > > Are these well known problems ? > > I can't find an example in the pysnmp code (or documentation) for the hlapi.asyncore version of bulkCmd(). Is this because no-one uses it ? > > Would I be better off switching from hlapi bulkCmd() to the "Native SNMP API" version ? > > Regards, > > Graham > > -- |
From: Ilya E. <il...@gl...> - 2016-08-29 21:06:32
|
You should definitely bind your script to 0.0.0.0 or any other non-loopback interface. If you still see no packets coming into the script, try enabling debugging in pysnmp to see if packets ever reach it and the reason why it does not respond. from pysnmp import debug debug.setLogger(debug.Debug(‘all’)) > On 29 Aug 2016, at 16:41, rajesh chandra <cxr...@gm...> wrote: > > Hi Paul, > > I have tried all the possible scenarios which includes 0.0.0.0 address but i still see same behavior. > > Interesting(and also frustrating) thing is , I can see SNMP trap(see below) on My VM's eth0 but nothing on Listener script :( . > > mulamall@tpcvm40:~$ sudo tcpdump -i eth0 > tcpdump: verbose output suppressed, use -v or -vv for full protocol decode > listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes > 15:15:24.047840 IP device.55718 > .snmp-trap: F=ap U=usr-md5-des [!scoped PDU]36_6b_6b_5f_b8_25_36_14_e5_f6_cd_3d_a1_75_bb_e2_c3_3e_f5_68_da_28_c1_41_d5_1f_f1_85_1d_9f_60_c1_89_e5_ad_61_35_94_c9_34_01_70_09_df_39_ac_30_e9_c0_1d_3b_b7_15_67_33_63_3f_fe_1e_56_c1_7d_1d_f3_eb_2d_ca_76_af_03_c7_45_9e_70_9b_eb_b4_5c_b9_f4_c8_d7_17_d2_03_f5_75_6b_b4_79_73_a2_1b_9c_a0_40_13_68_82_e7_1c_14_df_f1_ce_9d_00_a7_dc_1a_d5_fe_0d_e6_2a_0e_81_5a_cd_04_38_cb_1b_6e_53_d5_a4_a3_e9_ee_18_f8_1c_46_95_d8_bc_51_ba_7f_f3_b0_e0_1b_b9_4e_17_03_6d_95_24_3d_ab_be_bc_ea_e1_39_16_d3_cd_54_7e_6b_62_19_8f_8a > > > On Mon, Aug 29, 2016 at 10:30 AM, <Pau...@de...> wrote: > > > On Aug 29, 2016, at 9:55 AM, rajesh chandra <cxr...@gm...> wrote: > > > > Hi, > > > > I have PySNMP notification receiver for SNMP V3 traps as below... > > > > Instead of localhost IP , I have My VM ip -----> for this scenario, I am not receiving any traps if generate one from outside the VM(I am using snmptrap command from another machine) but I can see SNMP data when I do tcpdump on VM eth0. If I generate trap on same machine(My VM) I can see trap data via PySNMP trap receiver script. I have no issues with network connectivity and FW is not blocking any of My data. > > ... > > > > # UDP over IPv4 > > config.addSocketTransport( > > snmpEngine, > > udp.domainName, > > udp.UdpTransport().openServerMode(('127.0.0.1', 162)) > > That address/port pair is used as the argument on a socket bind() call. The address, if specified, means you only want packets from that address. If you want packets from any address, specify 0.0.0.0. > > paul > > > ------------------------------------------------------------------------------ > _______________________________________________ > pysnmp-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-users |
From: rajesh c. <cxr...@gm...> - 2016-08-29 14:41:23
|
Hi Paul, I have tried all the possible scenarios which includes 0.0.0.0 address but i still see same behavior. Interesting(and also frustrating) thing is , I can see SNMP trap(see below) on My VM's eth0 but nothing on Listener script :( . mulamall@tpcvm40:~$ sudo tcpdump -i eth0 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:15:24.047840 IP device.55718 > .snmp-trap: F=ap U=usr-md5-des [!scoped PDU]36_6b_6b_5f_b8_25_36_14_e5_f6_cd_3d_a1_75_bb_e2_c3_3e_f5_68_da_28_c1_41_d5_1f_f1_85_1d_9f_60_c1_89_e5_ad_61_35_94_c9_34_01_70_09_df_39_ac_30_e9_c0_1d_3b_b7_15_67_33_63_3f_fe_1e_56_c1_7d_1d_f3_eb_2d_ca_76_af_03_c7_45_9e_70_9b_eb_b4_5c_b9_f4_c8_d7_17_d2_03_f5_75_6b_b4_79_73_a2_1b_9c_a0_40_13_68_82_e7_1c_14_df_f1_ce_9d_00_a7_dc_1a_d5_fe_0d_e6_2a_0e_81_5a_cd_04_38_cb_1b_6e_53_d5_a4_a3_e9_ee_18_f8_1c_46_95_d8_bc_51_ba_7f_f3_b0_e0_1b_b9_4e_17_03_6d_95_24_3d_ab_be_bc_ea_e1_39_16_d3_cd_54_7e_6b_62_19_8f_8a On Mon, Aug 29, 2016 at 10:30 AM, <Pau...@de...> wrote: > > > On Aug 29, 2016, at 9:55 AM, rajesh chandra <cxr...@gm...> wrote: > > > > Hi, > > > > I have PySNMP notification receiver for SNMP V3 traps as below... > > > > Instead of localhost IP , I have My VM ip -----> for this scenario, I am > not receiving any traps if generate one from outside the VM(I am using > snmptrap command from another machine) but I can see SNMP data when I do > tcpdump on VM eth0. If I generate trap on same machine(My VM) I can see > trap data via PySNMP trap receiver script. I have no issues with network > connectivity and FW is not blocking any of My data. > > ... > > > > # UDP over IPv4 > > config.addSocketTransport( > > snmpEngine, > > udp.domainName, > > udp.UdpTransport().openServerMode(('127.0.0.1', 162)) > > That address/port pair is used as the argument on a socket bind() call. > The address, if specified, means you only want packets from that address. > If you want packets from any address, specify 0.0.0.0. > > paul > > |
From: <Pau...@De...> - 2016-08-29 14:30:32
|
> On Aug 29, 2016, at 9:55 AM, rajesh chandra <cxr...@gm...> wrote: > > Hi, > > I have PySNMP notification receiver for SNMP V3 traps as below... > > Instead of localhost IP , I have My VM ip -----> for this scenario, I am not receiving any traps if generate one from outside the VM(I am using snmptrap command from another machine) but I can see SNMP data when I do tcpdump on VM eth0. If I generate trap on same machine(My VM) I can see trap data via PySNMP trap receiver script. I have no issues with network connectivity and FW is not blocking any of My data. > ... > > # UDP over IPv4 > config.addSocketTransport( > snmpEngine, > udp.domainName, > udp.UdpTransport().openServerMode(('127.0.0.1', 162)) That address/port pair is used as the argument on a socket bind() call. The address, if specified, means you only want packets from that address. If you want packets from any address, specify 0.0.0.0. paul |
From: rajesh c. <cxr...@gm...> - 2016-08-29 13:55:42
|
Hi, I have PySNMP notification receiver for SNMP V3 traps as below... Instead of localhost IP , I have My VM ip -----> for this scenario, I am not receiving any traps if generate one from outside the VM(I am using snmptrap command from another machine) but I can see SNMP data when I do tcpdump on VM eth0. If I generate trap on same machine(My VM) I can see trap data via PySNMP trap receiver script. I have no issues with network connectivity and FW is not blocking any of My data. Please help me ASAP from pysnmp.entity import engine, config from pysnmp.carrier.asynsock.dgram import udp from pysnmp.entity.rfc3413 import ntfrcv from pysnmp.proto.api import v2c # Create SNMP engine with autogenernated engineID and pre-bound # to socket transport dispatcher snmpEngine = engine.SnmpEngine() # Transport setup # UDP over IPv4 config.addSocketTransport( snmpEngine, udp.domainName, udp.UdpTransport().openServerMode(('127.0.0.1', 162)) ) # SNMPv3/USM setup # user: usr-md5-des, auth: MD5, priv DES config.addV3User( snmpEngine, 'usr-md5-des', config.usmHMACMD5AuthProtocol, 'authkey1', config.usmDESPrivProtocol, 'privkey1' ) # user: usr-md5-des, auth: MD5, priv DES, contextEngineId: 8000000001020304 # this USM entry is used for TRAP receiving purposes config.addV3User( snmpEngine, 'usr-md5-des', config.usmHMACMD5AuthProtocol, 'authkey1', config.usmDESPrivProtocol, 'privkey1', contextEngineId=v2c.OctetString(hexValue='8000000001020304') ) # user: usr-md5-none, auth: MD5, priv NONE config.addV3User( snmpEngine, 'usr-md5-none', config.usmHMACMD5AuthProtocol, 'authkey1' ) # user: usr-md5-none, auth: MD5, priv NONE, contextEngineId: 8000000001020304 # this USM entry is used for TRAP receiving purposes config.addV3User( snmpEngine, 'usr-md5-none', config.usmHMACMD5AuthProtocol, 'authkey1', contextEngineId=v2c.OctetString(hexValue='8000000001020304') ) # user: usr-sha-aes128, auth: SHA, priv AES config.addV3User( snmpEngine, 'usr-sha-aes128', config.usmHMACSHAAuthProtocol, 'authkey1', config.usmAesCfb128Protocol, 'privkey1' ) # user: usr-sha-aes128, auth: SHA, priv AES, contextEngineId: 8000000001020304 # this USM entry is used for TRAP receiving purposes config.addV3User( snmpEngine, 'usr-sha-aes128', config.usmHMACSHAAuthProtocol, 'authkey1', config.usmAesCfb128Protocol, 'privkey1', contextEngineId=v2c.OctetString(hexValue='8000000001020304') ) # Callback function for receiving notifications def cbFun(snmpEngine, stateReference, contextEngineId, contextName, varBinds, cbCtx): print('Notification received, ContextEngineId "%s", ContextName "%s"' % ( contextEngineId.prettyPrint(), contextName.prettyPrint() ) ) for name, val in varBinds: print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) # Register SNMP Application at the SNMP engine ntfrcv.NotificationReceiver(snmpEngine, cbFun) snmpEngine.transportDispatcher.jobStarted(1) # this job would never finish # Run I/O dispatcher which would receive queries and send confirmations try: snmpEngine.transportDispatcher.runDispatcher() except: snmpEngine.transportDispatcher.closeDispatcher() raise |
From: Graham H. <gr...@ze...> - 2016-08-23 12:42:25
|
Hi All, I've a python+pySNMP script querying an agent using the hlapi (synchronous) api and I want to switch it to using the hlapi.asyncore api instead. This is with version 4.3.2 and using bulkCmd(). To do this I had to move most of my code into a callback function, create a cbCtx object to pass in a dict to store the results into and then call the snmp-engine's transport dispatcher. I've come across two problems: 1. Since the hlapi.asyncore version of bulkCmd() does not seem to support the "lexicographicMode=False" option, I now get "extra" results returned when the data in the asked-for table runs out. Sometimes this contains entries for "columns" in the table that I have *not* asked for, sometimes it contains "columns" from "rows" in the next table 2. My callback seems to be called only once per query, so if the table is larger than the number of rows that will fit in one response, the code does not issue a new request and my results are truncated. My callback does not return a value, but if I add a "return True" to the end, it seems to loop forever, including many, many, results from beyond the end of the asked-for table Are these well known problems ? I can't find an example in the pysnmp code (or documentation) for the hlapi.asyncore version of bulkCmd(). Is this because no-one uses it ? Would I be better off switching from hlapi bulkCmd() to the "Native SNMP API" version ? Regards, Graham -- *Graham Hudspith Zeetta Networks Limited*Software Engineer Engine Shed, Station Approach, gr...@ze... Temple Meads, Bristol, BS1 6QH United Kingdom zeetta.com <http://www.zeetta.com/> |
From: Reese, R. <re...@ec...> - 2016-07-28 17:20:53
|
Hi all, In version 4.3.2, I have a problem in that Pysnmp V3 authentication with SHA-256 privacy does not work to a Cisco device that I am using, while SHA-128 works fine. I have been using Pysnmp for quite a while and this is the first problem that I have encountered. Has SHA-256 privacy been verified to work? Any tips on debugging this? Thanks. Dr. Robert Reese Associate Professor, ECE, Mississippi State University US Mail: Box 9571, Miss State, MS 39762 Courier: 406 Hardy Rd, Simrall Bldg, Miss State, MS 39762 662 325 3154 |
From: Cannon I. <can...@gm...> - 2016-07-09 21:09:33
|
Hello! Well, basically I struggled with reinitialize the table for days... Finally the following approach did the trick: http://pysnmp.sourceforge.net/examples/v3arch/asyncore/agent/cmdrsp/agent-side-mib-implementations.html#implementing-scalar-mib-objects I mean: sub-classing the stuff and export the symbols. And use: mibBuilder.unexportSymbols("__EXAMPLE-MIB") to start anew, when the table changes. What is left is to query the db and update my own data structure (whats going to be exported in the end). Greetings! Joseph On Wed, Jul 6, 2016 at 1:50 PM, Cannon Imus <can...@gm...> wrote: > Hello! > > I followed the example: > > http://pysnmp.sourceforge.net/examples/v3arch/asyncore/agent/cmdrsp/agent-side-mib-implementations.html#implementing-conceptual-table > > The static version is working fine, now I should read the rows from a DB. > > I'd like to know what is the recommended way for implementing a dynamic > table? > > The FAQ entry: > http://pysnmp.sourceforge.net/faq/how-to-implement-agent-mib.html > says also something, but unfortunately I could not figure out, what the > author meant by: > "There are other ways for building MIB tables that represent dynamic > Managed Objects." > > Thanks a lot! > Joseph > |
From: Cannon I. <can...@gm...> - 2016-07-06 11:50:33
|
Hello! I followed the example: http://pysnmp.sourceforge.net/examples/v3arch/asyncore/agent/cmdrsp/agent-side-mib-implementations.html#implementing-conceptual-table The static version is working fine, now I should read the rows from a DB. I'd like to know what is the recommended way for implementing a dynamic table? The FAQ entry: http://pysnmp.sourceforge.net/faq/how-to-implement-agent-mib.html says also something, but unfortunately I could not figure out, what the author meant by: "There are other ways for building MIB tables that represent dynamic Managed Objects." Thanks a lot! Joseph |