Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dwmkerr/mongo-monitor
CLI to monitor the status of a MongoDB cluster real-time 📈
https://github.com/dwmkerr/mongo-monitor
Last synced: 7 days ago
JSON representation
CLI to monitor the status of a MongoDB cluster real-time 📈
- Host: GitHub
- URL: https://github.com/dwmkerr/mongo-monitor
- Owner: dwmkerr
- Created: 2018-03-09T09:11:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T01:22:27.000Z (over 4 years ago)
- Last Synced: 2024-10-16T02:41:24.690Z (23 days ago)
- Language: JavaScript
- Homepage:
- Size: 1.25 MB
- Stars: 77
- Watchers: 9
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-mongodb - mongo-monitor - Simple monitoring CLI (Tools / Monitoring)
- awesome-mongodb - mongo-monitor - Simple monitoring CLI (Tools / Monitoring)
README
# mongo-monitor
[![CircleCI](https://circleci.com/gh/dwmkerr/mongo-monitor.svg?style=shield)](https://circleci.com/gh/dwmkerr/mongo-monitor) [![codecov](https://codecov.io/gh/dwmkerr/mongo-monitor/branch/master/graph/badge.svg)](https://codecov.io/gh/dwmkerr/mongo-monitor) [![Greenkeeper badge](https://badges.greenkeeper.io/dwmkerr/mongo-monitor.svg)](https://greenkeeper.io/) [![GuardRails badge](https://badges.guardrails.io/dwmkerr/mongo-monitor.svg?token=569f2cc38a148f785f3a38ef0bcf5f5964995d7ca625abfad9956b14bd06ad96&provider=github)](https://dashboard.guardrails.io/default/gh/dwmkerr/mongo-monitor)
Simple CLI to monitor the status of a MongoDB cluster.
```bash
mongo-monitor mongodb://address:27017
```![Replicaset Screenshot](./docs/overview.gif)
The connection string is handled with [`mongo-connection-string`](https://github.com/dwmkerr/mongo-connection-string), which means it'll handle input which is not URI encoded.
Install with:
```bash
npm install mongo-monitor
```## Usage
The monitor is primary designed to show the status of a MongoDB cluster, updated real-time. This is useful when performing administrative operations such as replicaset or shard configuration.
On a sharded cluster, if you provide a connection string with admin priviledges to any `mongos` host, you will see the sharding configuration.
On a replicaset, if you provide a connection string with admin priviledges to any host, or to the entire set, you will see the replicaset configuration:
![Replicaset Screenshot](./docs/replicaset.jpg)
For a standalone, basic info is reported. Sharded clusters show details of the shards, as welll as the replicasets which make up each shard:
![Sharded Cluster Screenshot](./docs/sharded-cluster.jpg)
## Samples
To try the monitor out, there are a few samples you can try.
Monitor a standalone instance:
```bash
make sample-standalone
mongo-monitor localhost:271017
```Monitor a replicaset:
```bash
make sample-replicaset
mongo-monitor localhost:27017,localhost:27018,localhost:27019?replicaSet=cluster
```Monitor a sharded cluster:
```bash
make sample-shard
mongo-monitor localhost
```Cleanup sample processes:
```bash
make sample-shutdown
```## Developing
Lint with `npm run lint`, test with `npm test`, release with `npm run release`.
## Tests
The following files are useful for testing:
| File | Notes |
|------|-------|
| `shard.isMaster.json` | The output of `isMaster` for a `mongos` member of a sharded cluster. |
| `shard.node.isMaster.json` | The output of `isMaster` for a `mongod` member of a sharded cluster. |
| `shard.listShards.json` | The output of `listShards` for a `mongos` member of a sharded cluster. |
| `shard.replset.replSetGetStatus.json` | The output of `replSetGetStatus` for a replicaset in a sharded cluster. |
| `replset.isMaster.json` | The output of `isMaster` for a replicaset. |
| `replset.replSetGetStatus.json` | The output of `replSetGetStatus` for a replicaset. |
| `replset.serverStatus.json` | The output of `serverStatus` for a replicaset. |
| `standalone.isMaster.json` | The output of `isMaster` for a standalone server. |
| `standalone.serverStatus.json` | The output of `serverStatus` for a standalone server. |## Troubleshooting
```bash
mongo-monitor : command not found
```You need to change the npm config prefix
```bash
npm config set prefix /usr/localnpm root -g
```## Notes
There's also a little blog post on this here: [dwmkerr.com/mongo-monitor-cli/](https://www.dwmkerr.com/mongo-monitor-cli/).