Forum Discussion

Naman's avatar
Naman
Icon for Altostratus rankAltostratus
Dec 17, 2019

F5 iControl Rest API to get State and Status of All LTM/GTM pool members including other Partition in single API call

Hi,

 

We are using below API call to Retrieve State and Status of LTM Pool members in a single call

 

https://x.x.x.x/mgmt/tm/ltm/pool/members/stats

 

Above API call gives details of only Common Partition object, is there any way to get the details of Other Partition objects using single call for all pools.

 

Thanks,

 

Regards,

Naman

3 Replies

  • 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's avatar
      Naman
      Icon for Altostratus rankAltostratus

      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.

  • Is there any alternative method to get all the pools and their members stats in a single API call?

    I tried by dong a SNMP bulk walk but the names are getting truncated as mentioned here.

     

    did you implement with bulk API calls as you solution?

     

    Thanks.