Forum Discussion
Satoshi_Toyosa1
Employee
Unfortunately, there is no iControl REST call to get the pool stats from all the partitions in one shot. The underlying tmsh command, 'tmsh show ltm pool members' only reports the members under the current partition and does not provide any option to specify different partition(s). A workaround is:
1) Obtain a list of pools. GET /mgmt/tm/ltm/pool gives you all the pools irrespective of partitions.
2) Obtain the stats one by one: GET /mgmt/tm/ltm/pool/<pool>/stats.
This is my sample code using F5 Python SDK.
from f5.bigip import ManagementRoot
# Dump the object recursively
def recurse(dictionary, level):
for key, value in dictionary.iteritems():
if isinstance(value, dict):
print('{}{}:'.format(' '*level, key))
recurse(value, level+1)
else:
print('{} {} : {}'.format(' '*level, key, value))
mgmt = ManagementRoot('myHost, "myadmin", "myadminpasswd", debug=True)
pools = mgmt.tm.ltm.pools.get_collection()
print("Total pools: %-10s" % (len(pools)))
for pool in pools:
stat = pool.stats.load().__dict__['entries']
recurse(stat, 0)
Naman
Jul 15, 2020Altostratus
Thanks for your comment, Getting All one by one will be resource intensive, suppose any device has 5000 pools, Then ill be making 5000 calls to get pool and members details.
it creates problem on resources, cpu and memory spiked.