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)
到此这篇关于python检测lvs real server状态就介绍到这了。人生坎坎坷坷,跌跌撞撞那是在所难免。但是,不论跌了多少次,你都要坚强地再次站起来。任何时候,无论你面临着生命的何等困惑,抑或经受着多少挫折,无论道路如何的艰难,无论希望变得如何渺茫,请你不要绝望,再试一次,成功一定属于你!更多相关python检测lvs real server状态内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!