V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
dongcxcx
V2EX  ›  Python

如何用 Python 监控系统状态?

  •  
  •   dongcxcx · 2017-03-26 20:55:32 +08:00 · 3833 次点击
    这是一个创建于 2588 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这个周末花了点时间看了 Python 。自动化运维是 Python 一个比较擅长点,查看相关资料。 但是我有点疑惑的地方:

    比方说系统监控,有 20 台机器。 各自在本地运行个 python 脚本,然后有一台收集数据的机器,提供一个 http 接口口,接受这二十台数据传来的各自系统的性能数据。 在这台机器上去写一个展示层。

    1.思路是否是这样的? 2.通常这些数据都是通过 psutil 这个模块提供的数据。除了这些点还应该关注哪些点? 3.展示层有哪些好用的框架? 4.每台机器上的都需要跑这个 py 脚本。但是如果机器更多的话,难道需要一个个的拷贝上去吗?

    12 条回复    2017-03-28 11:24:49 +08:00
    AstroProfundis
        1
    AstroProfundis  
       2017-03-26 21:23:45 +08:00   ❤️ 1
    1. 大体上差不多
    2. 不清楚
    3. 现在似乎 Grafana 比较火,应该还有不少同类工具
    4. ansible, puppet 和各种类似物,最不济还可以 scp

    另外楼主可以了解一下主流监控系统比如 nagios, zabbix 甚至 new relic 这些商业解决方案,可以帮助理解 1. 的问题;还有 nagios-plugins (独立 fork 版叫 monitoring-plugins), collectd 之类的更接近你说的 2. 这种东东;前面这些并不局限于 Python
    nthhdy
        2
    nthhdy  
       2017-03-26 21:35:37 +08:00
    4 如果是云环境,比如 aws 或者阿里云,有创建磁盘 image 的功能,直接把这些脚本放到 root image 里.
    salmon5
        3
    salmon5  
       2017-03-26 22:38:00 +08:00
    “比方说系统监控, 1234 ”,轮子非常大,有现成的系统,别人很多年了,比如 zabbix 。
    Phant0m
        4
    Phant0m  
       2017-03-26 22:38:09 +08:00
    SaltStack
    ysicing
        5
    ysicing  
       2017-03-26 22:46:51 +08:00
    zabbix+定制监控脚本
    foo2bar
        6
    foo2bar  
       2017-03-26 23:07:20 +08:00 via iPhone
    收集数据交给 zabbix ,展示层用 py 脚本和 zabbix 结合吧
    ywgx
        7
    ywgx  
       2017-03-26 23:29:09 +08:00 via iPhone
    dangyuluo
        8
    dangyuluo  
       2017-03-26 23:59:20 +08:00
    你需要 pm2
    xiaohinata
        9
    xiaohinata  
       2017-03-27 09:28:43 +08:00
    prometheus 用于接收 http 接口传来的数据,开箱即用, gafanna 用于数据展示。
    SunnyFeng
        10
    SunnyFeng  
       2017-03-27 09:44:57 +08:00
    zabbix 采集数据,用 Grafana 来做数据展示,想同时安装部署一个服务到很多个节点可以考虑 puppet 之类的
    r0okit
        11
    r0okit  
       2017-03-27 11:02:42 +08:00
    Graphite+StatsD+Grafana+Diamond
    gwind
        12
    gwind  
       2017-03-28 11:24:49 +08:00
    1. saltstack
    2. telegraf , influxdb, grafana (TICK/ELK)
    3. zeromq , psutils, python
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   985 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:15 · PVG 06:15 · LAX 15:15 · JFK 18:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.