Forum Discussion
How to get all servers in a GTM pool (Python f5-sdk)
this code for type A and partition is Common:
from f5.bigip import ManagementRoot
mgmt = ManagementRoot('192.168.5.109', 'admin', 'xt32112300')
for i in mgmt.tm.gtm.wideips.a_s.get_collection():
try:
type_A_wideip = mgmt.tm.gtm.wideips.a_s.a.load(name=i.name)
except Exception as e:
print('type A widip name {} error msg is '.format(i.name) + str(e))
else:
if hasattr(type_A_wideip, 'pools'):
for pool_name in type_A_wideip.pools:
gslb_A_pool = mgmt.tm.gtm.pools.a_s.a.load(name=pool_name['name'])
gslb_pool_members_vs_name_list = [str(mem.name) for mem in gslb_A_pool.members_s.get_collection()]
print('type A wideip name: {} use gslb pool name is: {}; gslb_pool_members_vs_name_list: {}'.format(i.name, pool_name['name'], gslb_pool_members_vs_name_list))
code running result:
type A wideip name: www.bank.com use gslb pool name is: gslb_pool; gslb_pool_members_vs_name_list: ['dc1-vs', 'dc2-vs']
type A wideip name: www.gslb.xuwen.com use gslb pool name is: gslb_pool; gslb_pool_members_vs_name_list: ['dc1-vs', 'dc2-vs']
Process finished with exit code 0
This is great! Very helpful. I can use this as a reference. I want to take a VS, find what pools it is in, then what wideip has that pool.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com