dcrcli is a read-only command-line utility that copies diagnostic information from a MongoDB deployment so MongoDB Support can review it. It does not change your data, cluster configuration, or running processes.
By default it collects from one secondary only (to avoid load on primaries) and gathers the artifacts listed below. You can narrow nodes and/or artifact types interactively or with flags (see Collection scope and Collection data).
dcrcli is a diagnostic collector. It reads cluster metadata and copies existing files off the host. It does not write to your databases.
What it collects — a short list you can share with change-control:
| Artifact | What it is | How it is collected |
|---|---|---|
| getMongoData | Snapshot of server, replica-set, database, collection, and index stats | Read-only mongosh / mongo commands; collection stats stop after the safelimit (default 2500) |
| FTDC | MongoDB diagnostic metrics files (metrics.*) |
Local copy or rsync over SSH (read of existing files) |
| Mongod logs | Existing mongod / mongos log files |
Local copy or rsync over SSH (read of existing files) |
| Commands(List below) | Host and shell helpers below; included with every other choice; commands collects only these |
|
df -h |
Host filesystem usage | df on the node (SSH when the node is remote) |
df -h <dbpath> |
Disk usage of the MongoDB data directory | Same df, only on mongod (skipped on mongos) |
ulimit -a |
Process resource limits on the MongoDB host | Same host as df: on that node if dcrcli runs there, otherwise SSH |
rs.conf() |
Replica set configuration | Read-only shell helper (mongod) |
rs.status() |
Replica set member health and lag | Read-only shell helper (mongod); also present inside getMongoData, written here as a standalone file |
rs.printReplicationInfo() |
Oplog window | Read-only shell helper (mongod) |
rs.printSecondaryReplicationInfo() |
Replication lag | Read-only shell helper (mongod) |
sh.status() |
Sharded-cluster status | Read-only shell helper (mongos only) |
| Time-series collection check | Time series collections stored on this node (timeseriesCollectionCheck.txt) |
Read-only $listCatalog on admin, kept to system.buckets.*, on a data-bearing mongod. See Reading the migration checks. |
Unique indexes formatVersion |
Whether non-_id unique indexes still use a pre-4.2 format (uniqueIndexes.txt) |
Read-only $collStats on a data-bearing mongod, only for collections that have a non-_id unique index. Does not run validate(). |
serverStatus().shardedIndexConsistency |
Index consistency across shards | Read-only on the config-server primary (not mongos) |
The command outputs (df, ulimit, rs.*, sh.status on mongos, the time-series collection check and unique-index formatVersion on data-bearing mongods, and shardedIndexConsistency on the config primary) are collected for each target node they apply to. They run with every -collect-data choice, and -collect-data=commands collects only those outputs. Unique-index formatVersion runs $collStats only on collections that have a non-_id unique index. getMongoData, FTDC, and logs can be limited with -collect-data (see Collection data).
Production impact: the default scope is one secondary. Collection is sequential (one node at a time). If any discovered cluster member is unreachable, dcrcli stops instead of adding load to a degraded cluster. Prefer a secondary, and lower -max-collections if the catalog is large.
You can inspect every file under ./outputs/ locally before attaching anything to a support case.
getMongoData, the unique-index formatVersion check, and the time-series collection check stop after 2500 user collections (or 2500 time-series buckets) by default. That avoids a very large catalog turning into a long, heavy collection run.
If a script hits the cap it still writes what it has and sets truncated: true in the JSON (unique-index allNewFormat is then false so a partial scan cannot look complete). rs.*, sh.status(), df, and ulimit are not collection walks and have no cap.
To raise or lower the limit (no rebuild):
./<binary-name> -max-collections 10000
Or in the config file:
"max_collections": 10000-max-collections overrides max_collections in the config file. Omit both to keep the default 2500.
- Collection Details (read-only)
- Collection safelimit (max collections)
- Releases
- Prerequisites
- Usage
- Output Location
- Reading the migration checks
- Internal Notes
- Build from Source
- License
- Disclaimer
- Contributing
- Security
- Feedback / Issues
Download the latest prebuilt binaries:
For a successful collection, install and check these before running dcrcli.
On the dcrcli host (the machine where you run ./dcrcli):
| Need | When |
|---|---|
mongosh (preferred) or mongo on PATH |
Always |
rsync on PATH |
Collecting FTDC or mongod logs from remote nodes (this is the default all) |
Hostnames of every cluster member resolvable (same names as rs.status() / getShardMap) |
Always |
| TCP to every discovered MongoDB port for the whole run | Always (dcrcli aborts if any member is unreachable) |
| SSH from this machine to each remote MongoDB host | Collecting FTDC or logs from nodes that are not local; remote df / ulimit use the same SSH |
Free disk on this filesystem (abort below ~1.1 GB; plan (400 × N) + 1024 MB) |
Always |
On each MongoDB host (when that node is remote and you collect FTDC or logs):
| Need | When |
|---|---|
| SSH server reachable from the dcrcli host | FTDC or logs from that host |
| SSH user can read MongoDB FTDC and log files | FTDC or logs from that host |
df on PATH |
Remote df -h / df -h <dbpath> |
ulimit |
Shell builtin on that host (not on the dcrcli laptop unless it is the node) |
MongoDB access:
| Need | When |
|---|---|
Database user with backup, readAnyDatabase, and clusterMonitor |
Authentication enabled |
| The same user as a shard-local user on each shard replica set (create once on each shard primary) | Sharded cluster, collecting from shard mongods |
Same shard-local user plus directShardOperations on each shard primary (not only on mongos) |
MongoDB 8.0+ sharded cluster, if you need getMongoData on each shard mongod |
Details:
- Network Access
- Hostnames of all nodes in the MongoDB cluster must be resolvable from the machine running dcrcli.
- Use the same hostnames as the cluster configuration (e.g., those shown by rs.status()).
- Allow firewall access from the dcrcli host to MongoDB ports (e.g., 27017, 27018, etc.).
- Every discovered node (all
mongods, plusmongosand config-server members on sharded topologies) must be reachable from the dcrcli host on its listening port for the whole duration of the run. dcrcli probes every member before starting and again before each per-node collection step, and aborts with exit code 1 if any node is unreachable (see Cluster health pre-check). - When FTDC or mongod logs are collected from nodes that are not on the dcrcli host, allow SSH from the dcrcli host to those nodes. Remote
df -handulimit -ause that same SSH access; dcrcli does not prompt for SSH only to collect those host commands.
- MongoDB Shell
- Either the mongo or mongosh shell must be installed on the machine running dcrcli (dcrcli prefers mongosh when both are on
PATH). - Use the latest mongosh (current stable). This is strongly recommended, especially for sharded clusters and whenever dcrcli must discover node roles (primary vs secondary). Newer mongosh emits reliable JSON for topology and role checks; the legacy mongo shell may not parse the same way, which can leave roles unknown and cause secondary-only collection to fail until you use mongosh or choose all-nodes.
- Quick checks:
which mongosh
or
echo "$PATH"
- If authentication is enabled:
- Use a database user with the appropriate permissions (see “Minimum Required Permissions” in the getMongoData README: https://github.com/mongodb/support-tools/blob/master/getMongoData/README.md#more-details). The interactive prompt asks for the
backup,readAnyDatabase, andclusterMonitorroles. - If the password contains special characters (e.g., $, /, ?, #), input them directly without percent encoding.
- Sharded clusters (self-managed / SCRAM): dcrcli authenticates directly to each target
mongod/mongoswith the same username and password. A user created only through mongos lives on the config servers. That user can collect from mongos and CSRS members, but shardmongods will returnAuthentication failedunless the same user (same password and roles) also exists as a shard-local user on each shard replica set. Create it once on each shard primary (it replicates to that shard’s secondaries). See Users in Self-Managed Deployments (shard-local vs cluster users). Scope that includes shard members (all-nodes,all-secondaries, orone-secondarywhen the chosen secondary is a shard member) needs those shard-local users. LDAP/x.509 cluster-wide identities are a different setup. - MongoDB 8.0+ sharded clusters: starting in 8.0, a shard
mongodonly accepts a limited set of direct commands. Clients should use mongos. getMongoData on a shard runslistCollections/getIndexes/collStatson every local database. Those commands are not on that list. WithoutdirectShardOperationson the shard-local user, getMongoData can fail on shardmongods that locally have user databases (You are connecting to a sharded cluster improperly by connecting directly to a shard). Grant the role on each shard primary — granting it only through mongos is not enough (that user lives on the config servers; dcrcli authenticates to each shard with the shard-local user). mongos and config-server getMongoData, plus FTDC, logs, andrs.*on the shards, still succeed.directShardOperationsis a maintenance role: use it for the collection window, then remove it from the shard-local users. Keepbackup/readAnyDatabase/clusterMonitor. Replica sets that are not sharded are unaffected. Public docs allow a direct-to-shard exception during replica set → 1-shard conversion; that exception ends once a second shard is added. A cluster that was always 1-shard is not documented as exempt.
- Use a database user with the appropriate permissions (see “Minimum Required Permissions” in the getMongoData README: https://github.com/mongodb/support-tools/blob/master/getMongoData/README.md#more-details). The interactive prompt asks for the
- Remote FTDC, logs,
df, andulimit(SSH / rsync)
- Install rsync on the dcrcli host (
which rsync). It is required to copy FTDC and mongod logs from remote nodes. The default collection (all) includes those artifacts. - Required when collecting FTDC or mongod logs from remote nodes (
-collect-dataincludesftdcorlogs, which is the defaultall), and when-collect-data=commandsso remotedf/ulimitcan run. Using passwordless SSH is recommended for an unattended run.- Note: rsync over SSH copies FTDC and log files from the hosts to the dcrcli host. If passwordless SSH is not configured, you type the SSH password once per node (FTDC, logs, and host commands share one connection). Passwordless SSH is still recommended for unattended runs.
- The SSH user must have read permissions on MongoDB log and FTDC files.
dfmust exist on each MongoDB host (PATHon that machine).ulimitis a shell builtin on that same host (not on the laptop you run dcrcli from, unless that laptop is the node).- If SSH daemons on nodes use non-default ports, specify them via SSH config on the dcrcli host.
- If hostnames used on MongoDB nodes are not resolvable, add their IP addresses to /etc/hosts on the dcrcli host.
- Disk space on the dcrcli host
- Outputs are written under
./outputs/<cluster_name>/(plus./outputs/temp/while a remote node is copied). There is no second cluster-level archive during the run; zip/tar the output directory yourself when you are done. - Planning estimate: leave at least
(400 × N) + 1024MB free on the filesystem where you run dcrcli, whereNis the number of nodes you will collect from (same count as collection scope — one secondary →N = 1; all-nodes on a 3-member replica set →N = 3). Examples: one secondary → about 1.5 GB; three nodes → about 2.2 GB. - This is a rule of thumb, not a limit. FTDC is typically ~100–500 MB per
mongod. Mongod logs are uncapped and often dominate; busy hosts with large log files can need several extra GB. Command outputs (df,ulimit,rs.*,sh.status) are tiny. - During the run, dcrcli aborts if free space on the current working directory’s filesystem drops below about 1.1 GB. Check before you start:
df -h .
- After you have copied or compressed what you need to send, you can remove
./outputs/<cluster_name>/to reclaim space.
Follow these steps:
- Download the latest release: https://github.com/mongodb-labs/dcrcli/releases
- Transfer the binary to a machine that can access the MongoDB nodes.
- Make it executable:
chmod +x <binary-name>
- Run using a config file (recommended) or interactively:
With a config file — connection details come from the file (easy to re-run and fix). If username is set, dcrcli still prompts for the MongoDB password (it is never stored in the file):
./<binary-name> -config dcrcli.config.json
Interactively — follow on-screen prompts for cluster name, seed host/port, MongoDB credentials, which artifacts to collect, SSH username (only if FTDC or logs are selected), and which nodes to collect:
./<binary-name>
Run ./<binary-name> -h for a full summary of flags.
Flags:
| Flag | Purpose |
|---|---|
-config path |
Load connection details from a JSON config file (recommended). |
-generate-config path |
Write a sample config file to path and exit. |
-collect-nodes mode |
Collection scope: one-secondary, all-secondaries, or all-nodes. |
-collect-data types |
Which artifacts to collect: all, or a comma-separated list of getmongodata, ftdc, logs, commands. commands collects only the command outputs. Other choices still include those outputs. |
-max-collections n |
Collection-walk safelimit for getMongoData, unique-index formatVersion, the time-series check, and the _id type check. Default 2500. Overrides max_collections in the config file. |
A config file lets you set all connection details upfront so you never have to re-enter them. If a run fails, the error message tells you exactly which field to fix — just update the file and re-run.
Step 1 — Generate a sample file:
./<binary-name> -generate-config dcrcli.config.json
This writes a dcrcli.config.json file with placeholder values and prints a description of each field. The file is created with 0600 permissions to restrict read access to the config file.
Step 2 — Edit the file with your values:
{
"cluster_name": "my-cluster",
"seed_host": "localhost",
"seed_port": "27017",
"username": "",
"uri_options": "",
"ssh_username": "",
"collect_nodes": "one-secondary",
"collect_data": "all",
"max_collections": 2500
}| Field | Description |
|---|---|
cluster_name |
Display name used for the output directory. |
seed_host |
Reachable mongod/mongos used to discover other cluster members. Defaults to localhost if blank. |
seed_port |
Port of the seed node. Defaults to 27017 if blank. |
username |
MongoDB admin username. Leave blank for clusters without authentication. If set, dcrcli prompts for a password at startup (password is never stored in the config file). |
uri_options |
Extra URI connection options in name=value&name2=value2 format. Do not include replicaSet here — dcrcli discovers topology itself. |
ssh_username |
OS username for SSH/rsync to remote nodes when collecting FTDC, logs, or commands. Leave blank if all nodes are on the same machine as dcrcli. Ignored when collect_data is getmongodata only (FTDC/logs/commands off; remote df is then skipped). |
collect_nodes |
Which nodes to collect from: one-secondary (default), all-secondaries, or all-nodes. Leave blank to be prompted interactively. |
collect_data |
Which artifacts to collect: all (default), or a comma-separated list of getmongodata, ftdc, logs, commands. commands collects only the command outputs. Other choices still include those outputs. Leave blank to be prompted interactively. |
max_collections |
Collection-walk safelimit for getMongoData, unique-index formatVersion, the time-series check, and the _id type check. Default 2500. Omit or 0 to use the default. -max-collections overrides this. |
Step 3 — Run:
./<binary-name> -config dcrcli.config.json
dcrcli prints a summary of what was loaded from the file before proceeding, so you can confirm the values at a glance:
Loading config from: dcrcli.config.json
cluster_name: my-cluster
seed_host: mongo-node1.internal
seed_port: 27017
username: diag_user
password: [will prompt interactively]
uri_options: (none)
ssh_username: ubuntu
collect_nodes: one-secondary
collect_data: all
Enter MongoDB Password:
The password prompt does not echo input to the screen. It is never stored in the config file or on disk — it only exists in memory for the duration of the run. For no-auth clusters (username left blank), the prompt is skipped entirely.
If a field fails validation, the error names the field and tells you which file to edit:
Config validation failed: config field "uri_options": FATAL: do not enter replicaSet in options
Fix the value in dcrcli.config.json and re-run.
Note: The
-collect-nodes/-collect-data/-max-collectionsflags always take precedence over the matching config file values, which in turn take precedence over the interactive prompts.
After topology is discovered, dcrcli asks which nodes to collect from (unless you pass a flag). You can also pass:
./<binary-name> -collect-nodes=one-secondary
./<binary-name> -collect-nodes=all-secondaries
./<binary-name> -collect-nodes=all-nodes
Run ./<binary-name> -h for a short summary of flags.
- If
-collect-nodesis set, it overrides the interactive menu (useful for scripts and CI). - If stdin is not a terminal (non-interactive), the default is
one-secondarywithout prompting.
| Value | Behavior |
|---|---|
| one-secondary | A single secondary member only (smallest footprint; no extra mongos/config added). |
| all-secondaries | Every secondary (including config-server members that are secondaries). On a sharded topology, dcrcli also adds one mongos and one config-server mongod from getShardMap that are not already in that list (first of each when sorted by hostname/port). |
| all-nodes | Every host dcrcli discovered: all shard mongods (primaries and secondaries), all mongos, all config-server members. A full cluster capture: more nodes than secondary-only, so the run takes longer and the output directory is larger. Collection is still sequential (one node at a time). |
Sharded clusters: Use a mongos as the seed host when possible (same as before). For all-secondaries, one router and one CSRS member are included when the topology is detected as sharded. getShardMap does not always list every mongos; the seed mongos is added to the list when missing (and may be the mongos chosen for option 2). The time-series collection check ($listCatalog for system.buckets.*) and unique-index formatVersion run on shard mongods (not mongos). serverStatus().shardedIndexConsistency runs on the config-server primary only — use all-nodes to include that member. If auth is enabled, also create the collection user on each shard replica set (see Prerequisites); a mongos-only cluster user is not enough for direct connections to shard mongods. On MongoDB 8.0+, getMongoData on shard mongods also needs directShardOperations on each shard-local user (not only on mongos). Without it, that node’s getMongoData can fail while FTDC/logs/rs.* still collect. See Prerequisites for the replica-set → 1-shard conversion exception.
Replica sets (non-sharded): all-secondaries and one-secondary only collect secondary mongod members; there is no separate mongos/config layer.
Standalone (single mongod): If only one data node is discovered and it is not a secondary (normal for standalone), and you use options 1 or 2 without -collect-nodes, dcrcli prints a WARNING and asks whether to collect from that primary anyway (y / yes to continue). There is no extra prompt when you pass -collect-nodes or when stdin is not a terminal—use -collect-nodes=all-nodes for unattended standalone runs.
dcrcli can limit getMongoData, FTDC, mongod logs, and the command outputs. The command outputs are df -h, df -h <dbpath>, ulimit -a, rs.conf(), rs.status(), rs.printReplicationInfo(), rs.printSecondaryReplicationInfo(), the time-series collection check and unique-index formatVersion on data-bearing mongods, sh.status() on mongos, and serverStatus().shardedIndexConsistency on the config-server primary. They are included with every other -collect-data choice. -collect-data=commands collects only those outputs.
By default it collects all types. To collect one type (for example getMongoData, or commands only), use:
./<binary-name> -collect-data=getmongodata
./<binary-name> -collect-data=ftdc
./<binary-name> -collect-data=logs
./<binary-name> -collect-data=commands
./<binary-name> -collect-data=getmongodata,ftdc
./<binary-name> -collect-data=all
Or set "collect_data": "getmongodata" in the config file.
- If
-collect-datais set, it overrides the interactive menu. - If stdin is not a terminal (non-interactive), the default is
allwithout prompting. - When only getMongoData is selected (no FTDC, logs, or
commands), dcrcli skips the SSH username prompt and ignoresssh_usernamein the config file. Remotedf -his then skipped for nodes that are not local; replica-set / mongos helpers still run over the MongoDB port. commandsasks for the SSH username so remotedf/ulimitcan run. Replica-set and mongos helpers still use the MongoDB port.
| Value | Behavior |
|---|---|
| all | Collect getMongoData, FTDC, and mongod logs (default). Command outputs are still collected. |
| getmongodata | Run getMongoData / mongoWellnessChecker only (no FTDC or mongod log copy). Command outputs are still collected. |
| ftdc | Copy FTDC metrics only. Command outputs are still collected. |
| logs | Copy mongod logs only. Command outputs are still collected. |
| commands | Command outputs only. No getMongoData, FTDC, or mongod logs. |
Combine types with commas. Aliases: gmd / get-mongo-data for getMongoData; mongod-logs / log for logs; command for commands.
Interactive menu: When prompted, choose one of five options:
| Choice | Collects |
|---|---|
| 1 (default) | getMongoData, FTDC, and mongod logs (plus command outputs) |
| 2 | getMongoData only (plus command outputs) |
| 3 | FTDC only (plus command outputs) |
| 4 | mongod logs only (plus command outputs) |
| 5 | command outputs only |
To combine types (for example getMongoData and logs without FTDC), use -collect-data or collect_data in the config file — there is no custom free-text option in the interactive menu.
Collection progress: During data collection, dcrcli prints a progress bar and a per-node summary when collection finishes. The summary lists only artifact types that were collected, failed, or selected but could not run — types omitted from the selection are hidden. Successful tasks show ✓; failed tasks show ! (and the node line is marked ! as well); selected artifacts that could not run (for example FTDC on a remote node with no SSH user) show −. Example when only getMongoData was selected:
✓ mongo1:27017 ✓ getMongoData ✓ commands
Example when all types were selected but FTDC failed on one node:
! mongo1:27017 ✓ getMongoData ! FTDC ✓ logs ✓ commands
dcrcli collects diagnostic data (getMongoData, FTDC, and/or mongod logs) against live (typically production) clusters, so it refuses to collect from any node while another cluster member is unreachable. Proceeding in that state can mask a partial outage and adds avoidable load to a cluster that is already degraded. This gate applies for every -collect-data selection, not only getMongoData.
The health check is a lightweight TCP probe (5-second timeout per node, sequential) against every node discovered by the topology finder — not just the nodes selected by -collect-nodes. On a sharded topology this includes all mongods plus the mongos and config-server members that were discovered.
It runs in two phases:
| Phase | When | What happens on failure |
|---|---|---|
| pre-collection | Once, right after topology discovery and before the first node is touched | dcrcli aborts before any getMongoData, FTDC, or log copy work runs |
| pre-iteration | At the start of every per-target iteration of the collection loop | dcrcli aborts before moving on to the next target, so a mid-run degradation does not stack additional load on the cluster |
When a node is unreachable, dcrcli prints an ERROR banner listing every offending host:port, records a terminating message in the dcrcli log (dcrlogfile_*.log), and exits with code 1. Example console output:
######################################################################
# ERROR #
######################################################################
Cluster health check failed (pre-iteration).
The following MongoDB node(s) are unreachable:
- shard0-rs1.example.net:27017
dcrcli collects diagnostic data against live clusters; refusing to proceed while any cluster node is down to avoid added production risk.
Verify all members are healthy (e.g. rs.status()) and retry.
If you see this, verify the named member with rs.status() (or sh.status() on a sharded cluster), bring it back, and retry. There is no flag to bypass the check — it is intentional.
- Collected artifacts are written under
./outputs/<cluster_name>/, with one subdirectory per node (<hostname>_<port>). Review this directory locally before sharing it. - Per node you will typically see:
getMongoData.json— when getMongoData was selectedftdcarchive.tar.gz— when FTDC was selectedlogarchive.tar.gz— when logs were selected- DCR command outputs (always collected):
df-h.txtanddf-h-dbpath.txt— host disk usage. Remotedfruns only when SSH was already enabled for FTDC/logs; otherwise the files record that df was skipped.df -h <dbpath>is omitted on mongos.ulimit-a.txt— process limits on the node. Same SSH skip behavior asdfwhen the node is remote and SSH was not enabled.rs.conf.txt,rs.status.txt,rs.printReplicationInfo.txt,rs.printSecondaryReplicationInfo.txt— replica-set helpers on replica-setmongod. Skipped on standalone (the files record the skip). On mongos these are replaced bysh.status.txt.timeseriesCollectionCheck.txtanduniqueIndexes.txt— migration checks on a data-bearingmongod. Field-by-field meaning is in Reading the migration checks.serverStatus.shardedIndexConsistency.txt— on a config-server primary only (not mongos). If the collected config member is a secondary, the file records that skip. Use-collect-nodes=all-nodeson a sharded cluster to include the config primary.
- Typical runtime: ~2–15 minutes depending on cluster size and network conditions.
- dcrcli does not create a cluster-level archive. After completion, compress the output directory (zip/tar.gz) yourself for upload.
These two files are written on every data-bearing mongod (a replica-set member or a shard mongod). They are not written on mongos, config servers, or arbiters. Each one stops at the collection safelimit. truncated: true means the file is incomplete.
Time series collections store their data in internal system.buckets.* collections. This file is the list of those collections on this node, from collectionless $listCatalog on admin.
buckets: [] means this node has no time series collections. A hit includes the owning database (for example dcrcli_script_test.system.buckets.ts).
A unique index other than _id. Starting in MongoDB 4.2, with feature compatibility 4.2 or greater, unique indexes use a new internal format that older binaries cannot read. dcrcli reads WiredTiger metadata.formatVersion from $collStats storage stats. It does not run validate().
13or14means the 4.2+ format (newFormat: true). Any other value is also copied intooldFormat.allNewFormat: truemeans every unique index that was checked uses that format.truncated: truemeans some collections were not checked, andallNewFormatis thenfalse.
- After each execution, a log file is created in the current working directory. E.g: dcrlogfile_1755165313.log
- getMongoData
- dcrcli invokes the mongo or mongosh shell with a compatible getMongoData.js script. Ensure the shell is in PATH. mongosh is preferred for consistent JSON from topology commands (
hello,getShardMap, role detection). Collection-walk scripts share one cap:-max-collections/ configmax_collections(see Collection safelimit).
- dcrcli invokes the mongo or mongosh shell with a compatible getMongoData.js script. Ensure the shell is in PATH. mongosh is preferred for consistent JSON from topology commands (
- Node selection uses shell output to classify PRIMARY, SECONDARY, MONGOS, etc. Keep mongosh up to date for best results on sharded clusters.
- DCR command outputs are collected with the same mongosh/mongo
--evalargv pattern as topology probes (hardcoded embedded scripts; no shell interpolation). Localdfisdfargv. Localulimit -aissh -cwith a compile-time constant. Remotely,df -h,df -h <dbpath>, andulimit -arun in one SSH session (dbpath only after the Unix path allowlist). For a remote node, OpenSSH connection sharing (ControlMaster=auto) reuses that session for FTDC rsync, log rsync, and the host commands so password SSH prompts once per node. - rsync
- Remote FTDC copy is similar to
rsync -az <ssh-username>@<hostname>:<src-path> <dest-path>. - Remote mongod log copy adds
--include=<logfile>* --exclude=*. - Note: The utility sequentially connects to each node, which may take time for deployments with a large number of nodes.
- Remote FTDC copy is similar to
To build dcrcli from source, use the following commands based on your operating system:
Linux amd64 build steps example:
- Assume you are on a Linux amd64 machine
- Clone the rep
git clone <repo-link>- Run the build:
GOOS=linux GOARCH=amd64 go buildPull requests are welcome. For significant changes, open an issue first to discuss scope and approach. Add or update tests where applicable.
dcrcli is a read-only collector — see Collection Details (read-only). Do not include sensitive data (credentials, PII) in issues or PRs. For security disclosures, contact maintainers privately.
Please note: all tools/ scripts in this repo are released for use "AS IS" without any warranties of any kind, including, but not limited to their installation, use, or performance. We disclaim any and all warranties, either express or implied, including but not limited to any warranty of noninfringement, merchantability, and/ or fitness for a particular purpose. We do not warrant that the technology will meet your requirements, that the operation thereof will be uninterrupted or error-free, or that any errors will be corrected.
Any use of these scripts and tools is at your own risk. There is no guarantee that they have been through thorough testing in a comparable environment and we are not responsible for any damage or data loss incurred with their use.
You are responsible for reviewing and testing any scripts you run thoroughly before use in any non-testing environment.
Thanks, The MongoDB Support Team