您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 果洛分类信息网,免费分类信息发布

python检测lvs real server状态

2025/2/11 14:19:08发布10次查看
复制代码 代码如下:
import httplib
import os
import timedef check_http(i):
    try:
        conn=httplib.httpconnection(i, 80, timeout=2)
        conn.request(get,/)
        response = conn.getresponse()
    except exception as e:
        print server +i+ is down
        print e
        print
        os.system('./delete_real_server.sh '+i)
    else:
        #print response.read()
        print server +i+ is up\n
        os.system('./add_real.server.sh '+i)
if __name__==__main__:
    httpservers=[127.0.0.1,10.0.0.1,192.168.35.28]
    while 1:
        current_time=time.strftime('%y-%m-%d %h:%m:%s',time.localtime(time.time()))
        for i in httpservers:
            check_http(i)
        print current_time+ check finish\n
        time.sleep(60)
果洛分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录