Perl/Python script to fetch the LB, VIP and pool details of a server

I have a database where all my LTMs information are stored. I am trying to get a perl/ python script.

The use case is: running the script with a specific server IP, I am expecting an output which will give me the list of all LTMs, VIP and pool it is associated to.

Please suggest.

Look at the F5-SDK for python. It is a simple module that uses iControl REST to get and set F5 configuration.

Good article to get you started is F5 Friday Python SDK for BIG-IP.

Not tested but something like the following as a very basic script (you would need to update the ‘listOfBipIPs’ to pull from your data base:

from f5.bigip import BigIP

listOfBigIPs = ["bigip1.example.com", "bigip2.example.com"]

for bigIP in listOfBigIPs:
    bigip = BigIP("bigip.example.com", "admin", "somepassword")

    virtuals = bigip.tm.ltm.virtual.get_collection()
    for virtual in virtuals:
        print ("VS: {}, Dest: {}".format(virtual.name, virtual.destination))
        print ("    Pool: {}".format(virtual.pool))

Hi,

I want a python script to update/modify a irule. Can somebody please help

Thanks,

Ahmed