• 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])
    
    
    
  • 相关阅读:
    linux下设置SSH无密码登陆
    设置sudo权限
    集群重启后启动ambari-server访问Web页面无法启动集群解决
    使用Ambari部署hadoop集群
    centos7.6安装python3.7
    Locust
    测试框架(自然语言)
    Maven之(七)pom.xml配置文件详解
    git的使用
    elastic search(es)安装
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348688.html
Copyright © 2020-2023  润新知