Skip to main content
HealOps 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 HealOps environment to your MongoDB instance
  • Valid credentials (if authentication is enabled)

Setup

Option 1: Interactive CLI

Select MongoDB when prompted and provide your connection string and target database.

Option 2: Environment variables

Add to your .env:

Option 3: Persistent store

Integrations are automatically persisted to ~/.config/healops/integrations.json:

Connection string formats

URL-encode special characters in credentials: @%40, :%3A, #%23

TLS configuration

TLS is enabled by default. For custom certificates:

Investigation tools

When HealOps investigates a MongoDB-related alert, five diagnostic tools are available:

Server status

Retrieves version, uptime, connection counts, operation counters, and memory usage. Useful for spotting high connection counts or unusual memory pressure.

Current operations

Lists operations running longer than a configurable threshold (default 1 s). Surfaces long-running queries and lock contention.

Replica set status

Reports member states, health, heartbeat intervals, and optime lag. Identifies unreachable members or sync delays.

Profiler

Reads the system.profile collection to surface slow queries, collection scans, and index usage. Requires MONGODB_DATABASE to be configured and profiling enabled on the target database.
Enable profiling with db.setProfilingLevel(1) (slow queries only) or db.setProfilingLevel(2) (all queries).

Collection statistics

Returns document count, storage size, index count, and average object size for a given collection.

Verify

Expected output:

Troubleshooting

Security best practices

  • 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.