• python diabled node


     Disabled (Only persistent or active connections allowed)
    
    只有永久连接和活动的连接
    
     Forced Offline (Only active connections allowed)
    
    关闭F5:
    #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
    if len(sys.argv) != 5:
        print sys.argv[0] + ' ' + 'f5managedip' + ' ' + 'username' + ' ' + 'passwd' + ' ' + 'nodeip'
    else :
     f5ip= sys.argv[1]
     username= sys.argv[2]
     passwd= sys.argv[3]
     nodeip= sys.argv[4]
     b = pc.BIGIP(
     hostname = f5ip,
     username = username,
     password = passwd,
     fromurl = True,
        wsdls=['LocalLB.NodeAddress'])
     node = b.LocalLB.NodeAddress
     ipaddress=nodeip
     #print node.set_monitor_state(node_addresses=[ipaddress],states=['STATE_FORCED_DISABLED'])
     #print node.set_monitor_state(node_addresses=['10.4.161.149'],states=['STATE_ENABLED'])
     a=node.get_object_status(node_addresses=[ipaddress])
     print a[0].availability_status
     node.set_monitor_state(node_addresses=[ipaddress],states=['STATE_FORCED_DISABLED'])
     b= node.get_object_status(node_addresses=[ipaddress])
     print b[0].availability_status
     if b[0].availability_status == 'AVAILABILITY_STATUS_RED':
       print "%s Node Status: %s" %(ipaddress,b[0].availability_status)
     else :
      print "请检查是否正常关闭 %s" %(ipaddress)
     print node.get_monitor_status(node_addresses=[ipaddress])
    
    
    
    开启F5:
    
    #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
    if len(sys.argv) != 5:
        print sys.argv[0] + ' ' + 'f5managedip' + ' ' + 'username' + ' ' + 'passwd' + ' ' + 'nodeip'
    else :
     f5ip= sys.argv[1]
     username= sys.argv[2]
     passwd= sys.argv[3]
     nodeip= sys.argv[4]
     b = pc.BIGIP(
     hostname = f5ip,
     username = username,
     password = passwd,
     fromurl = True,
        wsdls=['LocalLB.NodeAddress'])
     node = b.LocalLB.NodeAddress
     ipaddress=nodeip
     #print node.set_monitor_state(node_addresses=[ipaddress],states=['STATE_FORCED_DISABLED'])
     #print node.set_monitor_state(node_addresses=['10.4.161.149'],states=['STATE_ENABLED'])
     a=node.get_object_status(node_addresses=[ipaddress])
     print a[0].availability_status
     node.set_monitor_state(node_addresses=[ipaddress],states=['STATE_ENABLED'])
     b= node.get_object_status(node_addresses=[ipaddress])
     print b[0].availability_status
     if b[0].availability_status == 'AVAILABILITY_STATUS_BLUE':
       print "%s Node Status: %s" %(ipaddress,b[0].availability_status)
     else :
      print "请检查是否正常开启 %s" %(ipaddress)
    print node.get_monitor_status(node_addresses=[ipaddress])
    
    
    
  • 相关阅读:
    hdu 5534 Partial Tree 背包DP
    Educational Codeforces Round 1 E. Chocolate Bar 记忆化搜索
    Educational Codeforces Round 1 D. Igor In the Museum bfs 并查集
    Educational Codeforces Round 1 B. Queries on a String 暴力
    Educational Codeforces Round 1 A. Tricky Sum 暴力
    Codeforces Round #282 (Div. 1) A. Treasure 水题
    hdu 5565 Clarke and baton 二分
    hdu 5563 Clarke and five-pointed star 水题
    Codeforces Testing Round #12 C. Subsequences 树状数组维护DP
    Codeforces Testing Round #12 B. Restaurant 贪心
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348688.html
Copyright © 2020-2023  润新知