MJL85 / natlas

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

Changing from depth "2" to depth "3" causes an error #45

Open ipguru99 opened 5 years ago

ipguru99 commented 5 years ago

I have used this at a couple of places now, fantastic tool! But for some reason, I can run this command at a customer of mine:

python3 natlas-cli.py diagram -r 192.168.0.10 -d 3 -o \network1.png -c natlas.conf -t first_title

...and I get this:

Back filling node details... ['dot', '-Tpng', '/tmp/tmpdg9d8o3d'] return code: 1

stdout, stderr: b'' b"Error: /tmp/tmpdg9d8o3d: syntax error in line 128 near '['\n"

Traceback (most recent call last): File "natlas-cli.py", line 305, in main(sys.argv[1:]) File "natlas-cli.py", line 96, in main exec_mod(mod, argv[1:]) File "natlas-cli.py", line 167, in exec_mod modret = module.entryfunc(natlas_obj, argv) File "./modules/diagram.py", line 88, in mod_entry if (opt_output != None): natlas_obj.write_diagram(opt_output, opt_title) File "/home/bkastor/natlas/natlas/natlas.py", line 125, in write_diagram self.diagram.generate(output_file, diagram_title) File "/home/bkastor/natlas/natlas/output_diagram.py", line 108, in generate output_func(f) File "/usr/lib/python3/dist-packages/pydot.py", line 1691, in self.write(path, format=f, prog=prog)) File "/usr/lib/python3/dist-packages/pydot.py", line 1774, in write s = self.create(prog, format) File "/usr/lib/python3/dist-packages/pydot.py", line 1900, in create assert p.returncode == 0, p.returncode AssertionError: 1

...but when I run this command:

python3 natlas-cli.py diagram -r 192.168.0.10 -d 2 -o \network1.png -c natlas.conf -t first_title

It works great? I have tried digging around for a device that might be causing an issue, but this error doesn't point me in the right direction. Any hints as to what it might be? I have tried PNG and SVG.. the natlas.conf is the same between runs... Thanks for this awesome tool!!

spazman998 commented 5 years ago

i assume you get this error even if you set no depth? which would default to 100.. Do you get any weird output or failed snmp responses in the discover/collect stages?

I had an issue where a device was discovered but when it went to do the collect details it was failing and hitting an unexpected error i had to adjust some code in the snmp.py file. Your error doesn't look the same as what i was getting though.

ipguru99 commented 5 years ago

Thanks for the reply! It turned out to be trap receivers?? If I have:

snmp-server community publ1c RO snmp-server host 1.1.1.1 pubic

it won't go past this host (which is why level 2 was working, but not level 3). But as soon as I remove that second line, it will discover this switch and discover the devices past that.. very weird. I can reproduce it without issue.. very weird.. at least for me.

This is a really great tool, btw! I have used it at 2 customers and it always amazes me how IT people get excited about drawings ;-) Thanks again for this!!

bbrendon commented 4 years ago

This is the error I'm getting on a brocade network. If I add to the command -d 2 I get the error. If I add -d 1, I do not get the error. But with -d 1, the diagram is very incomplete.

# python3 natlas-cli.py diagram -r 10.10.11.254 -o diagram.svg
...snip
 (10.10.14.26) 0.00 sec

Back filling node details...
"dot" with args ['-Tsvg', '/tmp/tmpo9zusmlr'] returned code: 1

stdout, stderr:
 b'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"\n "http://www.w3.o
rg/Graphics/SVG
....snip
07" y="-142.4396" font-family="Times,serif" font-size="9.00" fill="#000000">C:0x0004f2efed5d</text>\n</g>\n</g>\n</[73/1390]
b'Error: not well-formed (invalid token) in line 1 \n... <b>\x01\n\n\x0e\x1a ...\nin label of node \x01\\n\\n\x0e\x1a\n'

Traceback (most recent call last):
  File "natlas-cli.py", line 305, in <module>
    main(sys.argv[1:])
  File "natlas-cli.py", line 96, in main
    exec_mod(mod, argv[1:])
  File "natlas-cli.py", line 167, in exec_mod
    modret = module.entryfunc(natlas_obj, argv)
  File "./modules/diagram.py", line 88, in mod_entry
    if (opt_output != None):    natlas_obj.write_diagram(opt_output, opt_title)
  File "/root/natlas/natlas/natlas.py", line 125, in write_diagram
    self.diagram.generate(output_file, diagram_title)
  File "/root/natlas/natlas/output_diagram.py", line 108, in generate
    output_func(f)
  File "/usr/local/lib/python3.7/dist-packages/pydot.py", line 1734, in new_method
    encoding=encoding)
  File "/usr/local/lib/python3.7/dist-packages/pydot.py", line 1817, in write
    s = self.create(prog, format, encoding=encoding)
  File "/usr/local/lib/python3.7/dist-packages/pydot.py", line 1945, in create
    assert process.returncode == 0, process.returncode
AssertionError: 1