由於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