Forum Discussion
JRahm
Jun 14, 2011Admin
that script is pycontrol v1. Don't go there... üôÇ
First, you need to install the pycontrol module available here: http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/4/aff/2108/showtab/groupforums/Default.aspx Click Here
Next, you need to use this updated version below. Note that the host, username, password, and a valid pool in the second function call in main (mine below is testpool) will need to reflect your environment. The reason the pool name has to be passed as a list is a limitation in the zip python method. If you don't pass as a list, the pool name will only be stored as the first character of the pool name.
!/usr/bin/python
def show_all_pools_status(obj):
''' Show the status of all pools '''
try:
pools = obj.get_list()
status = obj.get_object_status(pool_names = pools)
except:
"Unable to fetch pool list or get status - check trace log"
combined = zip(pools, status)
for x in combined:
print "Pool: ", x[0]
print "\t", x[1].availability_status
print "\t", x[1].enabled_status
print "\t", x[1].status_description
print "\n"*2
def show_pool_status(obj, pool_name = None):
''' show the status of a single pool '''
status = obj.get_object_status(pool_names = [pool_name])
combined = zip(pool_name, status)
for x in combined:
print "Pool: ", x[0]
print "\t", x[1].availability_status
print "\t", x[1].enabled_status
print "\t", x[1].status_description
print "\n"*2
if __name__ == "__main__":
import pycontrol.pycontrol as pc
Setup connection
host = '10.10.20.5'
uname = 'admin'
upass = 'admin'
b = pc.BIGIP(
hostname = host,
username = uname,
password = upass,
fromurl = True,
wsdls = ['LocalLB.Pool']
)
p = b.LocalLB.Pool
print "Fetching pool info...\n"
show_all_pools_status(p)
print "Fetching pool X info...\n"
show_pool_status(p, ['testpool'])