nagios 监控页面脚本
2013-11-04 10:50
344 查看
在企业应用当中,监控网站服务有时只靠端口的存活是不够的。
本脚本利用python监控网页url,靠网页返回关键字判断服务器服务状态是否正常,虽然简单但可满足很多需求:
[root@localhost nagios]# cat check_web
'''
Create 20131101
@cuc yangyang.feng
'''
#!/usr/bin/env python
import commands
import sys
from optparse import OptionParser
import urllib
import re
filehandle = urllib.urlopen("http://192.168.20.200/index.html")
content=filehandle.read()
filehandle.close()
#print(content)
if __name__ == '__main__':
if content.find('status:0 ok')>=0:
# if content.index('status:0 ok')==0:
print 'status:0 ok'
sys.exit(0)
else:
print 'No'
sys.exit(1)
本脚本利用python监控网页url,靠网页返回关键字判断服务器服务状态是否正常,虽然简单但可满足很多需求:
[root@localhost nagios]# cat check_web
'''
Create 20131101
@cuc yangyang.feng
'''
#!/usr/bin/env python
import commands
import sys
from optparse import OptionParser
import urllib
import re
filehandle = urllib.urlopen("http://192.168.20.200/index.html")
content=filehandle.read()
filehandle.close()
#print(content)
if __name__ == '__main__':
if content.find('status:0 ok')>=0:
# if content.index('status:0 ok')==0:
print 'status:0 ok'
sys.exit(0)
else:
print 'No'
sys.exit(1)
相关文章推荐
- 懒人nagios页面监控脚本O(∩_∩)O~
- 懒人nagios页面监控脚本
- 懒人nagios页面监控脚本
- nagios 插件脚本监控esxi 存储磁盘 小意外
- nagios监控haproxy(借助脚本)
- nagios监控日志脚本check_logfile
- nagios监控raid下磁盘和raid状态脚本实现
- Nagios监控磁盘脚本
- 用nagios监控http页面的方法
- nagios监控slave(借助脚本)
- 关于nagios系统下使用shell脚本自定义监控插件的编写
- Nagios监控内存脚本
- nagios脚本监控内存使用情况
- 自己编写Nagios监控脚本
- 用于Nagios中监控服务器连接数脚本
- nagios --redis 监控脚本
- nagios监控脚本编写
- nagios监控mysql(借助脚本)
- 关于nagios监控系统添加主机和服务脚本
- 通过collectd工具获取虚拟机的nagios监控脚本简单例子