[原创]用python检测LVS real server状态实现HTTP高可用
2013-10-24 18:55
597 查看
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)
相关文章推荐
- Android通过tcpdump抓包
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- 网络第三课(2)--解包(dns域名解析)
- 网络第三课(1)网络抓 包
- 【网络基础】TCP协议的三次握手过程
- 网络协议重新认识
- 如何检测ajax因网络断开或延时导致的错误并重连
- VS2005 PPC模拟器 连接网络的设置
- 30个北京情调自习室@http://www.douban.com/group/topic/16799387/
- 在向服务器发送请求时发生传输级错误。 (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有
- HttpHandler HttpModule入门篇
- Android实现自适应正方形GridView Read more: http://blog.chengyunfeng.com/?p=465#ixzz2id8EQPMq
- [转载]科学地安排自学时间@http://bbs.csdn.net/topics/390618739
- Linux网络编程一步一步学-异步通讯聊天程序select
- linux C 编程 之 socket 网络编程
- Linux网络编程一步一步学-select详解
- [转载]为什么开发人员工作10多年了还会迷茫?没有安全感?@http://bbs.csdn.net/topics/390458270
- 网络编程模型综述 之 UNIX网络I/O模型
- 复杂网络入门基础