markdown mongoDB监控工具

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown mongoDB监控工具相关的知识,希望对你有一定的参考价值。

# MongoDB Monitoring tools


## Run from the system cmd line

* Start/Stop/Restart MMS (Cloud Manager) agent service
``` sh
sudo systemctl start mongodb-mms-automation-agent.service
sudo systemctl stop mongodb-mms-automation-agent.service
sudo systemctl restart mongodb-mms-automation-agent.service
```

* List individual open connections
``` sh
$ sudo lsof -i | grep mongod
```

* mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data. 
``` sh
mongotop --port 27017 -u "admin" -p "anORgdGl67mWJAowR6VqIfzdQi52AlbB" --authenticationDatabase "admin"
```

* mongostat provides a quick overview of the status of a currently running mongod or mongos instance.
``` sh
mongostat --port 27017 -u "admin" -p "anORgdGl67mWJAowR6VqIfzdQi52AlbB" --authenticationDatabase "admin"
```

* Check the number of client connections to MongoDB
``` sh
sudo lsof -i | grep mongod
```

_or_

``` sh
sudo lsof | grep mongod | grep TCP
```

## Run from the mongo shell *(Requires Admin access)*

* Returns a general overview of the status of the database
``` sh
vivo_01 PRIMARY> db.serverStatus()
```

* addresses storage use and data volumes
``` sh
vivo_01 PRIMARY> db.Stats()
```

* provides statistics that resemble dbStats on the collection level
``` sh
vivo_01 PRIMARY> db.collStats()
```

* returns an overview of your replica set’s status
``` sh
vivo_01 PRIMARY> db.replSetGetStatus()
```

* Check the number of client connections to MongoDB
``` sh
vivo_01 PRIMARY> db.serverStatus().connections
```

* View the Oplog size and duration
``` sh
vivo_01 PRIMARY> rs.printReplicationInfo()
```

* View replication lag info
``` sh
vivo_01 PRIMARY> rs.printSlaveReplicationInfo()
```

以上是关于markdown mongoDB监控工具的主要内容,如果未能解决你的问题,请参考以下文章

进程监控工具supervisor 启动Mongodb

MongoDB客户端及监控工具

mongodb简单监控

mongodb自身简单监控

mongodb 监控工具 mongo-monitor 安装部署

MongoDB 监控