Forum Discussion
msandeep_311359
Nimbostratus
Mar 02, 2017fetch connection statistics of pool member from f5 python sdk
is there a f5 python sdk collection/resource to get the connection statistics of pool member?
which class we need to use to fetch statistics of pool member
Satoshi_Toyosa1
Aug 21, 2017Ret. Employee
Please refer to F5 Python SDK Documentation for the iControl REST Python interface documentation.
The sample code below is not optimal but does something similar to tmsh show ltm pool members.
from f5.bigip import ManagementRoot
mgmt = ManagementRoot('192.168.0.10', 'admin', 'admin')
pool = mgmt.tm.ltm.pools.pool.load(name='CentOS-all-80', partition='Common')
members = pool.members_s.get_collection()
for member in members:
stat = member.stats.load().raw
url1 = stat['selfLink']
url_nover = url1.split('?')[0] remove the 'ver=x.x.x'
url_dirs = url_nover.split('/') break into path segments
url_dirs.insert(-2, url_dirs[-2]) add extra object
url2 = '/'.join(url_dirs)
print url2
nestedStatsEntries = stat['entries'][url2]['nestedStats']['entries']
for key, value in nestedStatsEntries.iteritems():
print '\t{} = {}'.format(key, value)
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
