Get All Pool Member Status Using LTM, Python, and bigsuds
Problem this snippet solves:
I spent a bit of time trying to get this to work. Delivering the data in the correct format to the get_member_session_status method took me a while, so I thought I would post my solution.
Code :
#!/usr/bin/env python import sys import bigsuds def get_pools(obj): try: return obj.LocalLB.Pool.get_list() except Exception, e: print e def get_members(obj, pool): try: return pool, obj.LocalLB.Pool.get_member_v2(pool) except Exception, e: print e def get_status(obj, pool): try: return obj.LocalLB.Pool.get_member_session_status(pool) except Exception, e: print e try: b = bigsuds.BIGIP( hostname = “”, username = "admin", password = “admin”, ) except Exception, e: print e pools = get_pools(b) members = get_members(b, pools) for pool in pools: print "Pool: %s" % pool members = b.LocalLB.Pool.get_member_v2([pool]) status = b.LocalLB.Pool.get_member_session_status([pool], members) print "\tMembers:" for members, status in zip(members, status): count = 0 while count < len(members): print "\t\tHost: %s\tState: %s" % (members[count]["address"], status[count]) count += 1
Tested this on version:
11.6Published Aug 19, 2015
Version 1.0Mark_Stradling_
Cirrus
Joined February 25, 2010
Mark_Stradling_
Cirrus
Joined February 25, 2010
- Geoff_34657NimbostratusHow hard would it be to make this a webpage? I am happy I can see this information but, when you have a hundred pools and hundreds of nodes it just scrolls through the screen. I have just started working with psp but, it doesn't seem that this easily translates to that type.
- John_Heyer_1508CirrostratusNote that this will only show the admin status of each member. To get the healthcheck status, use: b.LocalLB.Pool.get_member_monitor_status([pool], members)
- Robert_47833Altostratusha, I catch u eventually