zabbix脚本获取web status code,异常告警
个人博客地址
python代码,需要安装requests库
1 #!/usr/bin/env python 2 #-*-coding:utf-8-*- 3 import requests,os,sys 4 url = sys.argv[1] 5 6 def webcode(): 7 try: 8 ret = requests.get(url,timeout=5) 9 code = ret.status_code 10 return code 11 except: 12 code = 1 13 return code 14 os._exit(0) 15 if __name__ == "__main__": 16 print(webcode())
zabbix配置文件略
前端配置
报警配置
以驱魔为理想,为生计而奔波