import sys
import pycontrol.pycontrol as pc
import time
import csv
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
pool='ESB_huigui_pool'
arr=[]
b = pc.BIGIP(
hostname = '10.1.10.160',
username = 'aaa',
password = '123456',
fromurl = True,
wsdls=['LocalLB.PoolMember'])
pools = b.LocalLB.PoolMember
print pools
print dir(pools)
print dir(pools)
a= pools.get_object_status(pool_names=[pool])
print type(a)
for x in a:
print '1111111111111111'
print x
print type(x)
print '2222222222222222'
for y in x:
print y
print type(y)
print dir(y)
print y.member
print type(y.member)
print y.member.address +':'+ str(y.member.port)
print y.object_status
print dir(y.object_status)
print y.member.address +':'+ str(y.member.port)+'=>'+y.object_status.availability_status +'=>'+y.object_status.enabled_status+'=>'+y.object_status.status_description
arr.append(y.member.address +':'+ str(y.member.port)+'=>'+y.object_status.availability_status +'=>'+y.object_status.enabled_status+'=>'+y.object_status.status_description)
print '-----------------------------------------------------------------------------------------------------------------------------------------------------'
print arr
-----------------------------------------------------------------------------------------------------------------------------------------------------
[10.4.160.127:0=>AVAILABILITY_STATUS_GREEN=>ENABLED_STATUS_ENABLED=>Pool member is available, 10.4.161.57:0=>AVAILABILITY_STATUS_RED=>ENABLED_STATUS_ENABLED=>Pool member has been marked down by a monitor]
-----------------------------------------------------------------------------------------------------------------------------------------------------
[10.4.160.127:0=>AVAILABILITY_STATUS_RED=>ENABLED_STATUS_DISABLED=>Forced down, 10.4.161.57:0=>AVAILABILITY_STATUS_RED=>ENABLED_STATUS_ENABLED=>Pool member has been marked down by a monitor]
[10.4.160.51:7013=>AVAILABILITY_STATUS_RED=>ENABLED_STATUS_ENABLED=>Pool member has been marked down by a monitor, 10.4.160.52:7013=>AVAILABILITY_STATUS_BLUE=>ENABLED_STATUS_ENABLED=>Pool member does not have service checking enabled]
Process finished with exit code 0
-----------------------------------------------------------------------------------------------------------------------------------------------------
[10.4.160.51:7001=>AVAILABILITY_STATUS_RED=>ENABLED_STATUS_DISABLED=>Forced down, 10.4.160.52:7001=>AVAILABILITY_STATUS_GREEN=>ENABLED_STATUS_ENABLED=>Pool member is available]