Forum Discussion

Tim_Harber's avatar
Jun 05, 2018

Getting active pool member connections using Python

If I want to see all of the client connections connecting to a pool member from the CLI I can do something like a "show sys connection ss-server-addr 1.2.3.4". I can also do this using Postman mapping to ";, but I cannot figure out how to do this via Python.

 

Using Python if I try to connect to "bigip.sys.raw" I do not see a module called "connection" or anything similar. Does anyone know how, or have some sample code on how to accomplish this?

 

Thanks!

 

10 Replies

  • The stats are pulled from the pool or member itself. Try this for an example:

    !/usr/bin/env python3
    
    from f5.bigip import ManagementRoot
    from getpass import getpass
    from pprint import pprint
    
    hostname = 'my.f5.ltm.net'
    username = 'foo'
    
    mgmt = ManagmentRoot(hostname, username, getpass())
    
    pool = mgmt.tm.ltm.pools.pool.load(name='my_pool_name')
    poolstats = pool.stats.load()
    
    pprint(poolstats.raw)
    
    members = pool.members_s.get_collection()
    member0_stats = members[0].stats.load()
    
    pprint(member0_stats.raw)
    
  • The stats are pulled from the pool or member itself. Try this for an example:

    !/usr/bin/env python3
    
    from f5.bigip import ManagementRoot
    from getpass import getpass
    from pprint import pprint
    
    hostname = 'my.f5.ltm.net'
    username = 'foo'
    
    mgmt = ManagmentRoot(hostname, username, getpass())
    
    pool = mgmt.tm.ltm.pools.pool.load(name='my_pool_name')
    poolstats = pool.stats.load()
    
    pprint(poolstats.raw)
    
    members = pool.members_s.get_collection()
    member0_stats = members[0].stats.load()
    
    pprint(member0_stats.raw)