Forum Discussion
DevBabu_124276
Nimbostratus
Mar 21, 2016How do I get pool stats using f5 sdk
How do I get Pool stats using f5 sdk.
Hannes_Rapp_162
Nacreous
Jan 18, 2017f5-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,
amintej_297711
Nimbostratus
Jan 18, 2017Thank you! I tested and it worked.
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