Skip to main content

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)
For Atlas Admin API metrics (not a connection string), see MongoDB Atlas.

Setup

Option 1: Interactive CLI

Provide your connection string and target database when prompted.

Option 2: Environment variables

Option 3: Persistent store

Credentials

Connection string formats

URL-encode special characters in credentials: @%40, :%3A, #%23
TLS is enabled by default. For custom certificates:

Investigation tools

Enable profiling with db.setProfilingLevel(1) (slow queries only) or db.setProfilingLevel(2) (all queries).

Verify

Expected output:

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.