Lesson 6: Diagnostic Tools: mongostat / Learn
Code Summary: Diagnostic Tools: mongostat
Review the following code, which demonstrates how to use the mongostat
tool.
The following example uses mongostat
to show the server statistics of a MongoDB cluster running at the URI mongodb+srv://dbaTestAdmin@cluster0.mntqoh9.mongodb.net
.
mongostat “mongodb+srv://dbaTestAdmin@cluster0.mntqoh9.mongodb.net”
The next example demonstrates how to use mongostat
to show the insert rate, query rate, and command rate in groups of three rows on the cluster running at the URI "mongodb+srv://dbaTestAdmin@cluster1.xwgj1.mongodb.net/"
. This command also specifies that the server statistics should be updated every two seconds.
mongostat -o='host,opcounters.insert.rate()=Insert Rate,opcounters.query.rate()=Query Rate,opcounters.command.rate()=Command Rate'
--rowcount=3 "mongodb+srv://dbaTestAdmin@m0cluster-restored.iy0a1o4.mongodb.net"
2
The following options can be used with the mongostat
command. Check out the MongoDB documentation for more information.
--o
--O
--rowcount