獲取pool所有的ip地址資訊
阿新 • • 發佈:2019-01-03
import sys import pycontrol.pycontrol as pc import time import csv import ssl ssl._create_default_https_context = ssl._create_unverified_context pool='YXPT_ust_pool' b = pc.BIGIP( hostname = '10.4.170.160', username = 'zjtlcb', password = 'xxx', fromurl = True, wsdls=['LocalLB.Pool']) pools = b.LocalLB.Pool print pools poolsarray=['ESB_huigui_pool','JinRongYunPT_API__16610_pool'] # for x in dir(pools): # print x for x in poolsarray: for y in pools.get_member(pool_names =[x]): # print y # print type(y) for aa in y: # print aa # print type(aa) print x+'=>'+aa.address+'=>'+str(aa.port) C:\Python27\python.exe C:/Users/tlcb/PycharmProjects/untitled/f5/get_all_member_ip.py <pycontrol.pycontrol.InterfaceInstance object at 0x04063A10> ESB_huigui_pool=>10.4.160.127=>0 ESB_huigui_pool=>10.4.161.57=>0 JinRongYunPT_API__16610_pool=>10.4.161.134=>16610 JinRongYunPT_API__16610_pool=>10.4.161.135=>16610