GithubHelp home page GithubHelp logo

monitor's Introduction

python编写的健康监控服务

linux上面的服务检测,python脚本编写的心跳检测,发现异常后通知钉钉机器人进行报警。

钉钉机器人

参考: 钉钉开放平台文档

image

python

python目录里面有3个文件

  • robot.py 钉钉机器人通知封装类
  • webhealth.py 心跳检测中心
  • monitorpy.log 日志

启动

python webhealth.py -p 80 -a www.baidu.com -r /aaa/bb.html
  • a:监听地址
  • p:监听端口
  • r:监听地址下对应的详细路径(可以不用)

service

将我们的python脚本程序封装成linux系统服务,方便管理。

  1. 将 service 下的 watchpy 拷贝到系统 /etc/init.d
  2. chmod +x /etc/init.d/watchpy
  • 开启监听服务
service watchpy start
  • 重启监听服务
service watchpy start
  • 停止监听服务
service watchpy start
  • 日志查看
tail -f monitorpy.log  //对应到该日志文件的位置

核心脚本是 webhealth.py ,可以自行改造以满足自己的需求。 交流添加微信: image

monitor's People

Contributors

344310362 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.