Overview
OpenSRE uses MongoDB diagnostics to investigate database-related alerts — checking server health, finding slow queries, monitoring replica sets, and analyzing collection statistics.Prerequisites
- MongoDB 4.0+ (4.4+ recommended)
- Network access from the OpenSRE environment to your MongoDB instance
- Valid credentials (if authentication is enabled)
Setup
Option 1: Interactive CLI
Option 2: Environment variables
Option 3: Persistent store
Credentials
Connection string formats
Investigation tools
Enable profiling with
db.setProfilingLevel(1) (slow queries only) or db.setProfilingLevel(2) (all queries).Verify
Troubleshooting
Security
- Use a read-only MongoDB user for monitoring — avoid admin credentials.
- Always enable TLS in production.
- Store connection strings in
.env, never in code. - Rotate credentials periodically.