Forum Discussion
xuwen
Feb 21, 2022Cumulonimbus
i suggest you use python sdk: f5-sdk
here is the code to find which gtm pool member is be disabled:
from f5.bigip import ManagementRoot
mgmt = ManagementRoot('192.168.5.110', 'admin', 'xt32112300')
for i in mgmt.tm.gtm.pools.a_s.get_collection():
for j in mgmt.tm.gtm.pools.a_s.a.load(name=i.name, partition='Common').members_s.get_collection():
if hasattr(j, 'disabled'):
print('type A gtm pool name {} member name {} has already been disabled and its fullpath is {}'.format(
i.name, j.name, j.fullPath))
result:
type A gtm pool name gslb_pool_ctc_v4 member name vs_ctc has already been disabled and its fullpath is /Common/DC-2-GTM-ipv4:/Common/vs_ctc
Process finished with exit code 0
here is the code to enable or disable gtm pool member:
gtm_pool_obj = mgmt.tm.gtm.pools.a_s.a.load(name='gslb_pool_ctc_v4')
mem_ctc = gtm_pool_obj.members_s.member.load(name='/Common/DC-2-GTM-ipv4:/Common/vs_ctc')
"""enable gtm pool member vs_ctc"""
mem_ctc.disabled = False
mem_ctc.enabled = True
mem_ctc.update()
mem_cuc = gtm_pool_obj.members_s.member.load(name='/Common/DC-2-GTM-ipv4:/Common/vs_cuc')
"""disable gtm pool member vs_cuc"""
mem_cuc.enabled = False
mem_cuc.disabled = True
mem_cuc.update()
- janarthananFeb 23, 2022Nimbostratus
Hi xuwen,
Thanks for looking into it . I am familier with java but will try with python. Can i get code for both LTM and GTM manipulation using python.