Forum Discussion
Ed_Summers
Jan 19, 2017Nimbostratus
F5 Python SDK: How to get virtual server availability?
Due to my limited Python and SDK experience I am finding it difficult to easily obtain the availability state of a virtual server. Given a 'virtual' object, what is the best/easiest way to return the...
Rob_74473
Cirrus
This is brutal to work with!
partition = 'C25'
pool_name = 'temp_test'
pool = mgmt.tm.ltm.pools.pool.load(name=pool_name, partition=partition)
stats = pool.stats.load()
for item in stats.entries:
params = stats.entries.get(item).get('nestedStats').get('entries')
stuff = ['activeMemberCnt','curSessions','serverside.curConns','serverside.maxConns','serverside.totConns','status.enabledState','status.availabilityState']
for item in stuff:
for key in ('value','description'):
if key in params[item]:
print("'{}': {}".format(item,params[item][key]))
OUTPUT:
'activeMemberCnt': 1
'curSessions': 0
'serverside.curConns': 0
'serverside.maxConns': 0
'serverside.totConns': 0
'status.enabledState': enabled
'status.availabilityState': available
DMA_95966
Apr 30, 2018Nimbostratus
Thanks a lot Rob , let me test it as well ..will update you on this..
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects