Working with Monitoring Tools

1. Using db.serverStatus() Command

SectionDetail
connectionscurrent, available, totalCreated
opcountersinsert/query/update/delete/getmore/command
wiredTigerCache, transactions, concurrent ops
metricsCursor, document, operation metrics

2. Monitoring with mongostat Utility

mongostat --uri=... 1
ColumnDetail
insert/query/update/deletePer-second op counts
dirty / usedWT cache %
qrw, arwQueued/active readers/writers

3. Monitoring with mongotop Utility

ColumnDetail
total / read / writeTime per collection
UseIdentify hot collections

4. Checking Current Operations

db.currentOp({ active:true, secs_running: { $gt: 5 } });

5. Killing Operations

MethodDetail
db.killOp(opid)Cancel an operation
CautionCannot kill internal ops

6. Monitoring Replication Lag

MethodDetail
rs.printSecondaryReplicationInfo()Per-secondary lag
replSetGetStatusoptimeDate vs primary

7. Checking Lock Statistics

SourceDetail
serverStatus().locksAcquire counts per resource
currentOp lockStatsPer-op wait time

8. Monitoring Memory Usage

MetricDetail
mem.residentRSS (MB)
tcmallocAllocator stats
wiredTiger.cache.bytesCurrently in cache

9. Checking Connection Metrics

MetricDetail
currentActive connections
availableRemaining slots
totalCreatedLifetime count

10. Using Free Monitoring

AspectDetail
EditionCommunity (non-Atlas)
Enabledb.enableFreeMonitoring()
Provides24h cloud dashboard URL