因爲工做中老是遇到一些私有化部署和不一樣環境的mongo server異常,爲了統一方便的監控其運行狀況,我篩選了多個工具,最終選擇了motop。python
motop是一款用python編寫的實時監控工具,能夠同時對多個MongoDB服務器進行監控。顯示當前操做。linux
項目地址:https://github.com/tart/motopgit
easy_install方式安裝:github
easy_install motop數據庫
查看幫助服務器
motop -h運維
主要用法解析工具
motop [host, host2, host3....]測試
須要驗證則用admin帳號(數據庫的root權限帳號和密碼)spa
motop [host] -u [user_name] -p [password]
# 監控預發佈環境。
motop xxx.xxx.xxx.xxx -u admin -p xxxxx
# 監控測試服
motop xxx.xx.xxx.xxx -u admin2 -p xxxxxx
多個受權驗證的mongo的監控能夠寫入配置文檔,motop.conf以下:
[TestMongoDBServer]
address=xxx.xxx.xxx.xx
username=admin
password=xxxxx
[PreStagingMongoDBServer]
address=xx.xxx.xxx.xxx
username=xxx
password=xxxx
motop -c /path/to/motop.conf
運行效果以下圖:
這樣能夠方便地實時監控多集羣mongo server的狀況,感受相似於linux的top效果。它的配置參數中也能夠增長對複製集的配置,靈活性比較強,適合運維監控使用。