Forum Discussion
9 Replies
hello,
you can use curl to get the pool stats :
curl -k -X GET https://bigip/mgmt/tm/ltm/pool/~Common~test_pool/stats
Here what I get on my lab :
{"kind":"tm:ltm:pool:poolstats","generation":1,"selfLink":"","entries":{"activeMemberCnt":{"value":0},"connqAll.ageEdm":{"value":0},"connqAll.ageEma":{"value":0},"connqAll.ageHead":{"value":0},"connqAll.ageMax":{"value":0},"connqAll.depth":{"value":0},"connqAll.serviced":{"value":0},"connq.ageEdm":{"value":0},"connq.ageEma":{"value":0},"connq.ageHead":{"value":0},"connq.ageMax":{"value":0},"connq.depth":{"value":0},"connq.serviced":{"value":0},"curSessions":{"value":0},"minActiveMembers":{"value":0},"monitorRule":{"description":"none"},"tmName":{"description":"/Common/aaa-ad-basile-pool"},"serverside.bitsIn":{"value":0},"serverside.bitsOut":{"value":0},"serverside.curConns":{"value":0},"serverside.maxConns":{"value":0},"serverside.pktsIn":{"value":0},"serverside.pktsOut":{"value":0},"serverside.totConns":{"value":0},"status.availabilityState":{"description":"unknown"},"status.enabledState":{"description":"enabled"},"status.statusReason":{"description":"The children pool member(s) either don't have service checking enabled, or service check results are not available yet"},"totRequests":{"value":0}}}
- Hannes_Rapp_162Nacreous
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,
- amintej_297711Nimbostratus
Thank you! I tested and it worked.
- Joel_BretonNimbostratus
I'm testing the example above and I'm getting None for 3 and 'NoneType' object is not subscriptable for 4.
I'm running Python 3.6.1, BIG-IP 12.1.2 and f5-sdk 2.3.3
- Joel_BretonNimbostratus
Found this thread that mentions the different format for version BIG-IP version 12
F5 Python SDK: How to get virtual server availability
- Hannes_RappNimbostratus
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,
- amintej_297711Nimbostratus
Thank you! I tested and it worked.
- Joel_BretonNimbostratus
I'm testing the example above and I'm getting None for 3 and 'NoneType' object is not subscriptable for 4.
I'm running Python 3.6.1, BIG-IP 12.1.2 and f5-sdk 2.3.3
- Joel_BretonNimbostratus
Found this thread that mentions the different format for version BIG-IP version 12
F5 Python SDK: How to get virtual server availability