推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
510908220
0.02D
V2EX  ›  Python

分享一个 Python 实现的简单基于数据上报监控系统

  •  
  •   510908220 ·
    CallStorm · Apr 11, 2018 · 5380 views
    This topic created in 2996 days ago, the information mentioned may be changed or developed.

    大家平时是否有过这样的场景呢:

    (1)定时备份数据到备份机

    (2)后台进程统计一些数据

    (3)每隔一段时间执行一些逻辑(同步数据等)

    但是,你是怎么确保:

    (1)代码执行

    (2)执行是否成功

    简单的方式可以是代码执行完后触发一个通知(短信、邮件、微信等),看起来好像也可以满足需求. 但是,仔细想想有如下弊端:

    1.假如有几十个类似的服务(分布在不同机器),每个服务执行完都触发通知. 这样相当于通知功能重复了几十遍(配置短信、微信、邮件等).

    2.要是一些通知方式修改了(邮件等账号变了或短信服务器变了等),意味着需要修改分布很多地方的代码

    3.难以统计分析,比如要分许某个服务一段时间内稳定性等.只能手动搜索邮件等去人肉查看了.

    我简单实现了一个针对这样场景的监控系统 https://github.com/510908220/heartbeats 有需要的可以交流改进~

    5 replies    2018-05-06 21:58:49 +08:00
    jeffson
        1
    jeffson  
       Apr 11, 2018
    Mark
    C0VN
        2
    C0VN  
       Apr 11, 2018
    类似于这种的服务?
    https://cronhub.io/
    https://healthchecks.io/
    xiaomayi0323
        3
    xiaomayi0323  
       Apr 11, 2018
    感谢分享
    510908220
        4
    510908220  
    OP
       Apr 12, 2018
    @xavierskip 看着确实游戏类似啊。healthchecks 我使用过,cronhub 第一次见,看着不错。从最近一段时间使用,类似这样的监控还是很好用的. 集中监控这类服务,非常有用
    mili8908
        5
    mili8908  
       May 6, 2018
    mark
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5368 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 08:49 · PVG 16:49 · LAX 01:49 · JFK 04:49
    ♥ Do have faith in what you're doing.