Virtual Server graphical App for F5 LTM

Code is community submitted, community supported, and recognized as ‘Use At Your Own Risk’.

Short Description

In this article, I will explore how to create a graphical representation of a virtual server using Python Flask, Pyvis libraries, and the IControl REST F5 API. This graphical representation will provide a visual representation of the virtual server, including the pools and pool members(servers) it is connected to, and also the URI.

(As irules can be really complex, this is mainly for irules with "if" and "switch" clauses.)

Problem solved by this Code Snippet

Having a graphical representation of how a virtual server distributes the traffic to its pools, makes it easier to understand.

How to use this Code Snippet

There are 2 main files:

  • F5_VIP_grapher.py
  • app.py

F5_VIP_grapher.py <VIP_name>  - this is how you run it and will generate the HTML files "static" folder.

app.py - this is the app that starts the Flask web server and provides a front-end to the F5_VIP_grapher.py.

There is also a Dockerfile that you can use to containerize this app.

There are 2 environment variables: Authorization_string (this is credentials(user:pass) for Basic authentication)
and IP_ADDRESS (this is the IP of the F5 device).

Code Snippet Meta Information

  1. Version: 1
  2. Coding Language: Python 3.10.9

Full Code Snippet

Here you can find the code: https://github.com/czirakim/F5_VIP_graph

 

Updated Apr 25, 2023
Version 2.0

Was this article helpful?

4 Comments

  • Hello,

    This code looks higly intersting but in my environnement, I doesn't manage to execute it. I am launching it through :

    python F5_VIP_grapher.py <vs-name>

    return :

    File "F5_VIP_grapher.py", line 66
    vip_name = f"{sys.argv[1]}"

     

  • I've tested it again, and it works for me(Python 3.10.9):

    python F5_VIP_grapher.py VIP1

    where VIP1 is the name of the Virtual Server(VIP)

    What version of python are you using?

  • I check and it seems my issue was related to my python version, thanks !

    python --version
    Python 2.7.5