#NodeAddress
# -*- coding: utf-8 -*-
import sys
import time
import csv
import ssl
reload(sys)
#ssl._create_default_https_context = ssl._create_unverified_context
import bigsuds
b = bigsuds.BIGIP(hostname = '10.4.170.160', username = 'zjtlcb', password = '12345678')
c=b.LocalLB.PoolMember
print c.set_monitor_state(['GXP_pool'], [[{'member': {'address' : '10.4.161.221', 'port': 25014}, 'monitor_state' : 'STATE_DISABLED'}]])
d=c.get_object_status(pool_names=['GXP_pool'])
for x in d:
for y in x:
if str(y['member']['address']) == '10.4.161.221':
if y['object_status']['availability_status'] == 'AVAILABILITY_STATUS_RED':
print str(y['member']['address']) +':'+ str(y['member']['port'])+ str(y['object_status'])
print 'poolmember 操作成功'
else:
print str(y['member']['address']) +':'+ str(y['member']['port'])+ str(y['object_status'])
print 'poolmember 操作失败'
AFAT1:~/sbin # cat enable_member.py.20191113
#NodeAddress
# -*- 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
import bigsuds
b = bigsuds.BIGIP(hostname = '10.4.170.160', username = 'zjtlcb', password = '12345678')
print dir(b)
c=b.LocalLB.PoolMember
print dir(c)
print c.set_monitor_state(['GXP_pool'], [[{'member': {'address' : '10.4.161.221', 'port': 25014}, 'monitor_state' : 'STATE_ENABLED'}]])