Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

F5 SDK help to login to multiple devices to search for a pool member

Thiyagu
Cirrus
Cirrus

 

Hello All,

I'm trying a lot for the automation. I'm finding a step to login to one device. I want my script to login to multiple device and to search for a pool member

 

Connect to the BigIP and configure the basic objectsmgmt = ManagementRoot("bigip.example.com", "admin", "somepassword")

 

Could you please help how can I use python sdk to login to multiple devices?

 

Regards,

Thiyagu

 

1 REPLY 1

Hello Thiyagu.

Try this:

from f5.bigip import ManagementRoot
 
# ----------------------------------------------------------
 
sessions = []
devices = ["bigip1.example.com", "bigip2.example.com"]
poolmember = "mymember"
 
for device in devices:
    session = ManagementRoot(device,"username","password",token=True)
    sessions.append(session)
 
for session in sessions:
    for pool in session.tm.ltm.pools.get_collection():
        for member in pool.members_s.get_collection():
            if member.name.split(':')[0] == poolmember:
                print("Pool member \"{}\" detected in {}".format(poolmember, session.hostname))

Regards,

Dario.

Regards,
Dario.