因为工做中老是遇到一些私有化部署和不一样环境的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效果。它的配置参数中也能够增长对复制集的配置,灵活性比较强,适合运维监控使用。