https://github.com/closeio/mongosniff-info
Analyze your MongoDB traffic
https://github.com/closeio/mongosniff-info
Last synced: 10 months ago
JSON representation
Analyze your MongoDB traffic
- Host: GitHub
- URL: https://github.com/closeio/mongosniff-info
- Owner: closeio
- Created: 2016-03-21T21:03:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-22T00:34:38.000Z (over 10 years ago)
- Last Synced: 2025-01-10T07:19:20.839Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 21
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### Analyze your MongoDB traffic
This script analyzes the output of a [mongosniff](https://docs.mongodb.org/manual/reference/program/mongosniff/)
command, giving you an insight into your MongoDB traffic. You can see which queries retrieve the most data
from your database or look at aggregate per-collection statistics. Here's what you should do to analyze
your production traffic:
1. On the MongoDB server: `sudo tcpdump -i eth0 -w dump.pcap 'port 27017'`
(caution: this will cause a CPU/disk IO spike, so make sure your machine
can handle it).
2. Download the pcap file to your local machine (e.g. via scp).
3. `mongosniff --source FILE dump.pcap > sniffed.log`
4. Run this script, e.g.:
* `python sniff_into sniffed.log sort`
* `python sniff_into sniffed.log aggregate`
#### When is this script useful?
This script is useful when your monitoring tools indicate that there's a lot
of data sent/received by your MongoDB server, but you're not certain which
queries are responsible for it.