AFAT1:~/sbin # cat view_poolmember_status.py
# -*- coding: utf-8 -*-
import sys
import time
import csv
import ssl
reload(sys)
sys.path.append('./pycontrol')
import pycontrol.pycontrol as pc
#ssl._create_default_https_context = ssl._create_unverified_context
if len(sys.argv) != 5:
print sys.argv[0] + ' ' + 'f5managedip' + ' ' + 'username' + ' ' + 'passwd' + ' ' + 'poolname'
else :
poolname = sys.argv[4]
a = pc.BIGIP(
hostname = sys.argv[1],
username = sys.argv[2],
password = sys.argv[3],
fromurl = True,
wsdls=['LocalLB.PoolMember'])
pool01 = a.LocalLB.PoolMember
b= pool01.get_object_status(pool_names=[poolname])
for x in b:
for y in x:
print y.member.address+'=>'+str(y.member.port)+'=>'+y.object_status.availability_status+'=>'+y.object_status.enabled_status+'=>'+y.object_status.status_description
AFAT1:~/sbin # python view_poolmember_status.py '10.4.170.160' 'zjtlcb' '12345678' 'ESB_huigui_pool'
10.4.160.127=>0=>AVAILABILITY_STATUS_GREEN=>ENABLED_STATUS_ENABLED=>Pool member is available
10.4.161.57=>0=>AVAILABILITY_STATUS_GREEN=>ENABLED_STATUS_ENABLED=>Pool member is available
AFAT1:~/sbin #