MJL85 / natlas

natlas - Network Discovery and Auto-Diagramming
GNU General Public License v2.0
511 stars 110 forks source link

Discovery issue: get_bulk not working correctly #24

Open pjw1024 opened 6 years ago

pjw1024 commented 6 years ago

I put comments in the get_bulk() function in snmp.py. It's not walking the sub-section of the MIB correctly (e.g. 1 vs. several rows of CDP data). From some debug printing, all the get_bulk calls return exactly 1 item, the first one.

I narrowed this down just now: the issue is the prettyPrint().startswith is returning False every time, so the for loop executes exactly once. When I comment that out in snmp.py, the same problem arises in node.py. So tracking down / fixing startswith calls seems to be the issue.

Printing strings shows that prettyPrint is converting the OID to use names: PRETTYPRINT: < SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.24.3.4 > OID for startswith: < 1.3.6.1.4.1.9.9.23.1.2.1.1 >

Adding "lookupMIB=False" to the tail end of the cmdGen.bulkCmd call fixes that. (Change in the flag's name or ???)

Context: I'm using pysnmp 4.4.2 on Ubuntu. Tried other versions of pysnmp, no joy. Using Python 2.7.

supportlan commented 6 years ago

Hi

Did you get a chance to solve this issue? I can snmpwalk my device using cli but the script isn't able. The result is I'm getting only my router and not every others connected to.

pjw1024 commented 6 years ago

Sorry, noted the problem, I think I fixed it for myself but quick fix / short on time so hesitant to post it.

On 2/11/18 1:04 PM, Francesco wrote:

Hi

Did you get a chance to solve this issue? I can snmpwalk my device using cli but the script isn't able. The result is I'm getting only my router and not every others connected to.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MJL85/mnet/issues/24#issuecomment-364772712, or mute the thread https://github.com/notifications/unsubscribe-auth/Ag9FDZSojpq87ndhjTJEXnm2DcHLluSHks5tTyuXgaJpZM4RCrQC.

-- Peter J. Welcher CCIE #1773, PhD in Math /Network Architect, Tech Advisor to VP Ops / O: 443.333.5730 M: 443.995.4859 NetCraftsmen http://www.netcraftsmen.com website http://www.netcraftsmen.com | blog http://www.netcraftsmen.com/resources/blog/ | twitter https://twitter.com/pjwelcher | vCard http://www.dynasend.com/signatures/vcard/pjw-at-netcraftsmen.com.vcf | linkedin https://www.linkedin.com/in/pjwelcher

supportlan commented 6 years ago

Can you share it with me please? I'm really stuck here and not able to found out what's the issue is. Don't worry, even if it's a quick and dirty fix, I'll be very happy.

pjw1024 commented 6 years ago

Ok, I think I solved it in December, but can't tell which files by timestamp. Those in the attached ZIP have my initials in them around code I was experimenting with.

I think (from skimming these) the issue was some missing checks on failure conditions that halted the program. I probably put in code to squawk but continue.

On 2/11/18 1:29 PM, Francesco wrote:

Can you share it with me please? I'm really stuck here and not able to found out what's the issue is.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MJL85/mnet/issues/24#issuecomment-364775093, or mute the thread https://github.com/notifications/unsubscribe-auth/Ag9FDb16k0aou6PJ3YGfcd_dVDoMC2SVks5tTzGlgaJpZM4RCrQC.

-- Peter J. Welcher CCIE #1773, PhD in Math /Network Architect, Tech Advisor to VP Ops / O: 443.333.5730 M: 443.995.4859 NetCraftsmen http://www.netcraftsmen.com website http://www.netcraftsmen.com | blog http://www.netcraftsmen.com/resources/blog/ | twitter https://twitter.com/pjwelcher | vCard http://www.dynasend.com/signatures/vcard/pjw-at-netcraftsmen.com.vcf | linkedin https://www.linkedin.com/in/pjwelcher

supportlan commented 6 years ago

Sorry where is the zip file?

pjw1024 commented 6 years ago

This time with attachment.

On 2/11/18 1:49 PM, Peter J. Welcher wrote:

Ok, I think I solved it in December, but can't tell which files by timestamp. Those in the attached ZIP have my initials in them around code I was experimenting with.

I think (from skimming these) the issue was some missing checks on failure conditions that halted the program. I probably put in code to squawk but continue.

On 2/11/18 1:29 PM, Francesco wrote:

Can you share it with me please? I'm really stuck here and not able to found out what's the issue is.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MJL85/mnet/issues/24#issuecomment-364775093, or mute the thread https://github.com/notifications/unsubscribe-auth/Ag9FDb16k0aou6PJ3YGfcd_dVDoMC2SVks5tTzGlgaJpZM4RCrQC.

-- Peter J. Welcher CCIE #1773, PhD in Math /Network Architect, Tech Advisor to VP Ops / O: 443.333.5730 M: 443.995.4859 NetCraftsmen http://www.netcraftsmen.com website http://www.netcraftsmen.com | blog http://www.netcraftsmen.com/resources/blog/ | twitter https://twitter.com/pjwelcher | vCard http://www.dynasend.com/signatures/vcard/pjw-at-netcraftsmen.com.vcf | linkedin https://www.linkedin.com/in/pjwelcher

-- Peter J. Welcher CCIE #1773, PhD in Math /Network Architect, Tech Advisor to VP Ops / O: 443.333.5730 M: 443.995.4859 NetCraftsmen http://www.netcraftsmen.com website http://www.netcraftsmen.com | blog http://www.netcraftsmen.com/resources/blog/ | twitter https://twitter.com/pjwelcher | vCard http://www.dynasend.com/signatures/vcard/pjw-at-netcraftsmen.com.vcf | linkedin https://www.linkedin.com/in/pjwelcher

pjw1024 commented 6 years ago

Oops.

On 2/11/18 1:51 PM, Francesco wrote:

Sorry where is the zip file?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MJL85/mnet/issues/24#issuecomment-364776847, or mute the thread https://github.com/notifications/unsubscribe-auth/Ag9FDbJIRrMRr-2sOCG68x489-j9UIl8ks5tTza0gaJpZM4RCrQC.

-- Peter J. Welcher CCIE #1773, PhD in Math /Network Architect, Tech Advisor to VP Ops / O: 443.333.5730 M: 443.995.4859 NetCraftsmen http://www.netcraftsmen.com website http://www.netcraftsmen.com | blog http://www.netcraftsmen.com/resources/blog/ | twitter https://twitter.com/pjwelcher | vCard http://www.dynasend.com/signatures/vcard/pjw-at-netcraftsmen.com.vcf | linkedin https://www.linkedin.com/in/pjwelcher

supportlan commented 6 years ago

Sorry still not seeing the attachment.

pjw1024 commented 6 years ago

I was in what I sent, twice. Hmm... something intercepting it?

On 2/11/18 2:07 PM, Francesco wrote:

Sorry still not seeing the attachment.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MJL85/mnet/issues/24#issuecomment-364778270, or mute the thread https://github.com/notifications/unsubscribe-auth/Ag9FDT2DNvmk4d5kZqWXrZ4-2l956UIHks5tTzp5gaJpZM4RCrQC.

-- Peter J. Welcher CCIE #1773, PhD in Math /Network Architect, Tech Advisor to VP Ops / O: 443.333.5730 M: 443.995.4859 NetCraftsmen http://www.netcraftsmen.com website http://www.netcraftsmen.com | blog http://www.netcraftsmen.com/resources/blog/ | twitter https://twitter.com/pjwelcher | vCard http://www.dynasend.com/signatures/vcard/pjw-at-netcraftsmen.com.vcf | linkedin https://www.linkedin.com/in/pjwelcher