Forum Discussion
Hannes_Rapp
Nimbostratus
f5-sdk 2.2.0 ; Python v3.4.3 ; BigIP 11.5.4
from f5.bigip import ManagementRoot
def get_pool_stats(p_name, p_partition):
"""Return all pool stats object (dict of dicts)"""
pool = API_ROOT.tm.ltm.pools.pool.load(name=p_name, partition=p_partition)
return pool.stats.load()
API_ROOT = ManagementRoot("bip-01", "admin", "admin")
POOL_STATS = get_pool_stats('pool_somepool', 'Common')
EXAMPLES OF USE:
1. Print all stats (complete dictionary of dictionaries, inclusive of irrelevant bulk)
print(POOL_STATS.raw)
2. Print all stats (entries dictionary - all key/value pairs of actual stats)
print(POOL_STATS.entries)
3. Print a specific extraction from entries dictionary
print(POOL_STATS.entries.get('curSessions'))
4. Print a specific extraction from entries dictionary (just value of a specific key)
print(POOL_STATS.entries.get('curSessions')['value'])
Regards,
Joel_Breton
Jun 07, 2017Nimbostratus
Found this thread that mentions the different format for version BIG-IP version 12
F5 Python SDK: How to get virtual server availability