// Full server status (large output — filter to what you need) db.serverStatus() // Key sections to watch: db.serverStatus().connections // { current: 47, available: 51153, totalCreated: 2841 } // Watch: current near available → connection pool exhaustion db.serverStatus().opcounters // { insert: 1243, query: 89123, update: 3421, delete: 104, getmore: 521 } // Watch: ratio of getmore → may indicate large result sets not paginated db.serverStatus().mem // { resident: 4096, virtual: 8192, mapped: 0 } (in MB) // resident = RAM in use; should be < available RAM with headroom db.serverStatus().wiredTiger.cache // "bytes currently in cache": 3,221,225,472 (3GB) // "maximum bytes configured": 4,294,967,296 (4GB WiredTiger cache max) // "pages read into cache": pages evicted: ... → high eviction = cache pressure db.serverStatus().wiredTiger["transaction"] // "transaction begins": total starts, "transaction rollbacks": watch for high rollbacks db.serverStatus().locks // Lock wait times by database — high waits indicate contention db.serverStatus().globalLock // currentQueue: { total, readers, writers } → HOW MANY OPS ARE WAITING FOR LOCKS db.serverStatus().network // bytesIn, bytesOut — total network throughput since last restart // Watch specific metrics over time (poor man's monitoring): (function pollStatus() { const s = db.serverStatus() print(new Date().toISOString(), "conns:", s.connections.current, "queue:", s.globalLock.currentQueue.total, "cache%:", Math.round(s.wiredTiger.cache["bytes currently in cache"] / s.wiredTiger.cache["maximum bytes configured"] * 100) ) })()
Key Metrics and Thresholds
| Metric | Where | Concern Threshold |
|---|---|---|
| Active connections | connections.current | >80% of connections.available |
| Lock queue | globalLock.currentQueue.total | >0 consistently — investigate blocking op |
| WiredTiger cache | wiredTiger.cache | >95% full → eviction pressure → slowdown |
| Page faults | extra_info.page_faults | Rising → working set exceeds RAM |
| Replication lag | rs.printSecondaryReplicationInfo() | >10s under normal load |