python检测lvs real server状态
import httplib
import os
import time
def 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)
相关文章
python不使用for计算两组、多个矩形两两间的iou方式
今天小编就为大家分享一篇python不使用for计算两组、多个矩形两两间的iou方式,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2020-01-01在django项目中导出数据到excel文件并实现下载的功能
这篇文章主要介绍了在django项目中导出数据到excel文件并实现下载的功能,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2020-03-03
最新评论