由于nagios过于复杂,以前弄zabbix又出现了未知情况。我只是想找个能实时收集数据进行分析的工具,无疑Glances是最好的选择。html
另外,我在找工具时,发现了一个比较不错的简易监控工具——linux dashboard。github上有,能够去研究下。python
glances的安装很是简单,不只支持直接在终端上显示数据,还支持在web上显示,除了监视本机的负载,还能够很是轻易地监控指定服务器(前提是装有Glances,并以server模式启动glances)的负载,甚至提供了REST和XML-RPC的编程接口,支持数据保存在CSV,html或InfluxDB和Statsdlinux
网址:http://nicolargo.github.io/glances/ios
文档(感谢做者提供了如此高质量的文档和程序):http://glances.readthedocs.org/en/latest/glances-doc.htmlgit
github上的参考内容(安装手册,API手册之类的):https://github.com/nicolargo/glancesgithub
我在本身的ubuntu14.04上安装了它(使用pip):web
apt-get install python-pip build-essential python-dev pip install glances bottle #若是你的linux上缺乏bottle这个模块,会没法在web上显示
能够这样更新:
docker
pip install --upgrade Glances
使用方法:shell
单机运行:编程
glances
能够按q退出
以web的形式展现:
glances -w
打开本身机器的61208端口:
关于C/S模式,参见:http://glances.readthedocs.org/en/latest/glances-doc.html#client-server-mode
关于编程支持:
先在被监控的服务器上以server模式启动
glances -s
再在另外一台带有python的机器上(也能够是本机localhost)编写这个程序:
$ vi test.py #!/usr/bin/python import xmlrpclib s = xmlrpclib.ServerProxy('http://10.20.10.71:61209') #注意改成被监控的服务器的IP print s.getSystem()
执行后:
关于可用的xml-rpc函数,请看:https://github.com/nicolargo/glances/wiki/The-Glances-2.x-API-How-to
做者也提供了一个docker镜像给咱们测试:https://github.com/nicolargo/glances/wiki/Install-and-test-Glances-DEVELOP-version
做者另外一份详细文档:https://github.com/nicolargo/glances/blob/master/docs/glances-doc.rst
若是你想把数据储存起来供其余服务使用,它支持保存为CSV,html或保存在InfluxDB和Statsd,也能够参考:
https://github.com/nicolargo/glances/blob/master/docs/glances-doc.rst#gateway-to-others-services
总的来讲,这个工具很是轻量级,也很是好用,将会被集成到个人我的项目中。
这个项目用的是LGPL协议
参考:
http://www.vpsee.com/2013/07/a-new-system-monitoring-tool-glances-installation-and-usage