ipspace / netlab

Making virtual networking labs suck less
https://netlab.tools
Other
403 stars 56 forks source link

[BUG] Graphite does not open the default topology file #1186

Closed pmsobral closed 1 month ago

pmsobral commented 1 month ago

Describe the bug

Graphite not working as expected

To Reproduce

Deploy the basic OSPF topology presented below :

Expected behavior

Everything works as expected except graphite. Connecting through the web browser presents an empty graph.

Lab topology

provider: clab defaults.device: eos module: [ ospf ]

nodes: [ r1, r2 ] links: [ r1, r2, r1-r2 ] tools: graphite:

Output

redes@RedesVM:~/netlab/basic-OSPF$ netlab create [CREATED] provider configuration file: clab.yml [CREATED] transformed topology dump in YAML format in netlab.snapshot.yml [CREATED] graphite configuration directory [CREATED] graphite/graphite-default.json rendering "graphite" format [GROUPS] group_vars for all [GROUPS] group_vars for modules [GROUPS] group_vars for eos [HOSTS] host_vars for r1 [HOSTS] host_vars for r2 [CREATED] minimized Ansible inventory hosts.yml [CREATED] Ansible configuration file: ansible.cfg

Version

netlab version 1.8.2

Additional context

redes@RedesVM:~/netlab/basic-OSPF$ netlab connect graphite Traceback (most recent call last): File "/home/redes/.local/bin/netlab", line 12, in netsim.cli.lab_commands(file) File "/home/redes/.local/lib/python3.10/site-packages/netsim/cli/init.py", line 321, in lab_commands mod.run(sys.argv[arg_start:]) # type: ignore File "/home/redes/.local/lib/python3.10/site-packages/netsim/cli/connect.py", line 232, in run connect_to_tool(host,rest,topology,log_level) File "/home/redes/.local/lib/python3.10/site-packages/netsim/cli/connect.py", line 190, in connect_to_tool msg = external_commands.get_tool_message(tool,topology) File "/home/redes/.local/lib/python3.10/site-packages/netsim/cli/external_commands.py", line 261, in get_tool_message return strings.eval_format(msg,topology) File "/home/redes/.local/lib/python3.10/site-packages/netsim/utils/strings.py", line 110, in eval_format return str(eval(ex,dict(data))) # An awful hack to use f-string specified in a string variable File "", line 1, in NameError: name 'sys' is not defined

ipspace commented 1 month ago

Unfortunately, we're in the 'it works for me' territory here :( I pulled down the latest graphite image just to be on the safe side and it works. Here's what Docker has to say about the image:

REPOSITORY            TAG       IMAGE ID       CREATED         SIZE
netreplica/graphite   0.4.2     6d52c47bb623   11 months ago   527MB
netreplica/graphite   latest    6d52c47bb623   11 months ago   527MB

On the odd chance that it might be a browser problem: what browser are you using? I'm on recent Chrome.

Also, what netlab version are you using? The latest versions display the URL to use, so you can just click on it. Make sure the URL ends in graphite, for example http://100.78.59.132:8080/graphite/

As for the netlab connect FUBAR, it's a bug. Opening an issue. Thanks a million for reporting it!

pmsobral commented 1 month ago

Hello Ivan,

Thank you very much for your answer. I'm on ubuntu 22.04 with latest netlab version (1.8.2) chrome is updated (124.0.6367.201), netreplica/graphite container is the same. Captura de ecrã 2024-05-14, às 17 34 39

Keep up the excellent work!

Regards,

Pedro

ipspace commented 1 month ago

Thank you very much for your answer. I'm on ubuntu 22.04 with latest netlab version (1.8.2) chrome is updated (124.0.6367.201), netreplica/graphite container is the same.

Good. Also, the screen is definitely coming from Graphite, but it looks like its configuration file is broken.

Could you please create a tar archive of the whole directory after the lab is started (tar cvf filename .) and post it? I'd like to see what Graphite configuration file netlab creates.

Thank you! Ivan

pmsobral commented 1 month ago

Hello again!

Sure! Here it is. basic-OSPF.tar.gz

Best Regards,

Pedro

ipspace commented 1 month ago

Sure! Here it is. basic-OSPF.tar.gz

Thank you. Everything looks normal, the Graphite JSON configuration file is identical to the one I have. I'm stumped...

Let's try to throw some spaghetti at the wall ;) because I have no better idea. Do docker ps to see what containers are running, find the container with graphite in its name (should be basic-OSPF_graphite), and do docker inspect containername to see whether the config file is mapped correctly.

Also, if you do docker exec basic-OSPF_graphite cat /htdocs/default/default.json you should see the configuration file from within the container. That one should match graphite/graphite-default.json.

pmsobral commented 1 month ago

Hello Ivan,

Thank you for your patience. In fact everything looks ok. The file is correctly mapped on the container as expected. If it is working with your setup...I don't really understand. Just to let you know that I have the same issue on other topologies as well.

Best Regards,

Pedro

ipspace commented 1 month ago

OK, managed to reproduce the bug: if I run Chrome in incognito mode, I get the same screen. Definitely a Graphite issue, now I have to figure out if we can work around it.

ipspace commented 1 month ago

Totally weird: Graphite versions 0.4.x consistently broke, but not until I disabled the browser cache (which is what happened in the incognito mode). As a workaround, I downgraded the netreplica/graphite image to version 0.3.0 until I figure out what's going on. Implemented in e538af9e7e0a6dfc1b3175ecfb634f296630c51c

ipspace commented 1 month ago

@pmsobral to test this fix, run netlab from a local Git repository. Installation details @ https://netlab.tools/install/clone/

You might have to clear the browser cache as well.

pmsobral commented 1 month ago

Thank you!