Skip to main content

MongoDB operations

v0.3.4

Replica-set + shard-cluster introspection, slow-query identification, collection stats, plus remediation surface (killOp, replSet stepDown, collection compact, dropIndex). Authenticates via MONGO_URI env var on the runner host.

31 allowed by default 3 need approval by default 1 denied by default
Pack ID
mongodb
Vendor
emisar
OS
linux
Actions
35
Required binaries. Install these on the host before relying on the pack — an action that calls a missing one fails at run time.
mongosh

Install

emisar pack install fetches this pack, re-validates it, and verifies its content hash against the --hash below — the exact bytes this page was rendered against, so a tampered copy is rejected — before copying it into the runner's packs dir. The command reloads a running daemon itself; no manual restart.

on the runner host
sudo emisar pack install mongodb --hash sha256:7c737c709bc7d854c94f7152307a55d64bda5dca033cca12ce4caa70dcf2c097

Actions 35 total

View on GitHub
  • mongo.balancer_status exec low

    sh.getBalancerState()

    Show whether the balancer is enabled + currently running.

    View source on GitHub
  • mongo.build_info exec low

    buildInfo

    Show server version + build flags.

    View source on GitHub
  • mongo.collection_list exec low

    db.getCollectionNames()

    List collections in one database.

    View source on GitHub
  • mongo.collection_stats exec low

    db.<coll>.stats()

    Show per-collection totals — count, size, storage, indexes.

    View source on GitHub
  • mongo.compact_collection exec high

    db.runCommand({compact:"<coll>"})

    Compact one collection on the connected node. Reclaims disk for WiredTiger after large deletes. BLOCKS reads/writes on the collection during compaction. Run during a low-traffic window; prefer running on a secondary first.

    View source on GitHub
  • mongo.concurrent_transactions exec low

    Read/write tickets (concurrency saturation)

    Show read/write ticket pools — out vs available. Queued/exhausted tickets are the classic sign of storage-engine overload. Version-tolerant: reads queues.execution on MongoDB 8.0+, else wiredTiger.concurrentTransactions (<= 7.0).

    View source on GitHub
  • mongo.connection_stats exec low

    Incoming connection saturation (serverStatus.connections)

    Show incoming connection counts — current, available, active, totalCreated. Approaching the available limit means new clients will be refused. Distinct from connections (connPoolStats), which is the outgoing pool.

    View source on GitHub
  • mongo.connections exec low

    connPoolStats

    Show connection pool stats — totals, active, available, by host.

    View source on GitHub
  • mongo.current_op exec low

    db.currentOp()

    List in-flight operations. The canonical "what is the server doing right now?" check.

    View source on GitHub
  • mongo.cursor_stats exec low

    Cursor saturation / timed-out cursors (metrics.cursor)

    Show cursor counts — open.total, open.noTimeout, open.pinned, timedOut, totalOpened. A growing timedOut count usually means an application is leaking cursors.

    View source on GitHub
  • mongo.db_list exec low

    listDatabases

    List all databases with size + empty flag.

    View source on GitHub
  • mongo.db_stats exec low

    db.stats()

    Show database-level totals — collections, indexes, data size, storage size.

    View source on GitHub
  • mongo.default_rw_concern exec low

    Default read/write concern (getDefaultRWConcern)

    Show cluster default read and write concern (e.g. w:majority) and its source. The durability/consistency config for the replica set — a weakened default write concern is a common cause of surprising data loss on failover.

    View source on GitHub
  • mongo.drop_index exec high

    db.<coll>.dropIndex("<name>")

    Drop one index from a collection. Use to remove a hot or unused index discovered via index_stats. Queries that relied on the index degrade to COLLSCAN until rebuilt or replaced.

    View source on GitHub
  • mongo.election_metrics exec low

    Election / stepdown history (electionMetrics)

    Show cumulative election and stepdown counters for this member — stepUpCmd, priorityTakeover, electionTimeout, catchUpTakeover, numStepDownsCausedBy HigherTerm, numCatchUps. Use to see how often the set has been re-electing.

    View source on GitHub
  • mongo.explain_query exec low

    explain a find()

    Show the execution plan for `find(filter)` on one collection at `executionStats` verbosity.

    View source on GitHub
  • mongo.get_parameter exec low

    getParameter '*'

    List all server parameters (read-only view of the current config).

    View source on GitHub
  • mongo.global_lock exec low

    Global lock queue / active clients (globalLock)

    Show global lock contention — currentQueue (total/readers/writers) waiting on the lock, and activeClients (total/readers/writers). A growing queue points to lock contention or an overloaded server.

    View source on GitHub
  • mongo.host_info exec low

    hostInfo

    Show host CPU, memory, NUMA layout, OS.

    View source on GitHub
  • mongo.index_builds exec low

    In-progress index builds (with progress)

    List active index-build operations with progress (done/total), via $currentOp. The canonical "is an index build stuck / how far along is it" check across the deployment.

    View source on GitHub
  • mongo.index_stats exec low

    $indexStats aggregation

    Show per-index access counts since server start. Zeros usually mean unused indexes.

    View source on GitHub
  • mongo.kill_op exec high

    db.killOp(opid)

    Kills one in-flight operation by opid.

    View source on GitHub
  • mongo.long_running_ops exec low

    Long-running active ops (currentOp, secs_running >= N)

    List active operations that have been running at least N seconds — the canonical hunt for a hung or blocked op. Filters currentOp by secs_running.

    View source on GitHub
  • mongo.oplog_size exec low

    Oplog size + window

    Show oplog size + first/last timestamps + estimated time window. The canonical "how far can a secondary fall behind?" check.

    View source on GitHub
  • mongo.profile_slow_queries exec low

    Read slow ops from the profiler (system.profile)

    Read the database profiler collection (system.profile) for the slowest recent ops over a millis threshold, newest first. Requires profiling to be enabled on the database already (see profiler_status); does not change it.

    View source on GitHub
  • mongo.profiler_status exec low

    db.getProfilingStatus()

    Show profiler level + slow-op threshold for one database.

    View source on GitHub
  • mongo.replication_info exec low

    Oplog time window (db.getReplicationInfo)

    Show oplog time window — logSizeMB, usedMB, timeDiff / timeDiffHours, tFirst, tLast. How much history the oplog retains, which bounds how long a secondary can be down before it needs a full resync. Distinct from oplog size.

    View source on GitHub
  • mongo.replset_config exec low

    rs.conf()

    Show replica set configuration — members, votes, priorities, settings.

    View source on GitHub
  • mongo.replset_lag exec low

    Replication lag (secs behind primary)

    Show per-member seconds behind the primary, computed from rs.status() optimeDate (with state, health, sync source, ping). The canonical replica-set lag check.

    View source on GitHub
  • mongo.replset_status exec low

    rs.status()

    Show replica set member health, lag, last applied optime.

    View source on GitHub
  • mongo.replset_stepdown exec critical

    rs.stepDown(<seconds>)

    Force the current primary to step down. Replica set elects a new primary; ~5–15s of write unavailability is typical. Use during planned failover when one secondary is known healthier.

    View source on GitHub
  • mongo.server_status exec low

    db.serverStatus()

    Show top-level server metrics: connections, ops counters, memory, cluster role.

    View source on GitHub
  • mongo.shard_status exec low

    sh.status()

    Show sharded cluster summary — shards, databases, chunk distribution.

    View source on GitHub
  • mongo.top exec low

    db.adminCommand({top:1})

    Show per-collection time spent in reads/writes/commands. Mongo "top" for query traffic.

    View source on GitHub
  • mongo.wiredtiger_cache exec low

    WiredTiger cache pressure (serverStatus.wiredTiger.cache)

    Show WiredTiger cache pressure — bytes currently in cache vs maximum configured, tracked dirty bytes, pages evicted by application threads, and pages read into cache. Application-thread eviction and a full dirty cache indicate memory pressure.

    View source on GitHub