Monitoring MongoDB
This plugin keeps track of your MongoDB instance.
MongoDB Metrics
- asserts.msg
- asserts.regular
- asserts.rollovers
- asserts.user
- asserts.warning
- connections.available
- connections.current
- connections.totalCreated
- mem: bits
- mem: mapped
- mem: mappedWithJournal
- mem: resident
- mem: supported
- mem: virtual
- opLatencies.commands.latency
- opLatencies.commands.ops
- opLatencies.reads.latency
- opLatencies.reads.ops
- opLatencies.writes.latency
- opLatencies.writes.ops
- opcounters.command
- opcounters.delete
- opcounters.getmore
- opcounters.insert
- opcounters.query
- opcounters.update
Install the MongoDB monitoring plugin
To install the MongoDB plugin you have to install the pymongo module pip install pymongo
.
After that edit /etc/nixstats.ini
. Add the following data.
[mongodb]
enabled=yes
connection_string=mongodb://username:password@127.0.0.1:27017/admin
Test the MongoDB plugin
Run sudo -u nixstats nixstatsagent test mongodb
and see if it return any data.
mongodb:
{
"asserts.msg": 0,
"asserts.regular": 0,
"asserts.rollovers": 0,
"asserts.user": 0,
"asserts.warning": 0,
"connections.available": 50743,
"connections.current": 457,
"connections.totalCreated": 0,
"mem": {
"bits": 64,
"mapped": 0,
"mappedWithJournal": 0,
"resident": 29966,
"supported": true,
"virtual": 45514
},
"opLatencies.commands.latency": 0,
"opLatencies.commands.ops": 0,
"opLatencies.reads.latency": 0,
"opLatencies.reads.ops": 0,
"opLatencies.writes.latency": 0,
"opLatencies.writes.ops": 0,
"opcounters.command": 0,
"opcounters.delete": 0,
"opcounters.getmore": 0,
"opcounters.insert": 0,
"opcounters.query": 0,
"opcounters.update": 0
}
Now restart the nixstats service to start sending data.
service nixstatsagent restart
Create Charts
One the dashboard you can now create a chart with your mongodb metrics. On the Metrics page select mongodb
as metric type, then select any of the metrics to create a chart.
Updated on: 09/05/2018
Thank you!