For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Thiyagu's avatar
Thiyagu
Icon for Cirrus rankCirrus
May 04, 2021

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

 

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

  • 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.