mongosniff1
Mongodb
Options
mongosniff
-
--help -
Returns a basic help and usage text.
-
--forward <host><:port> -
Declares a host to forward all parsed requests that the mongosniff intercepts to another
mongodinstance and issue those operations on that database instance.Specify the target host name and port in the
<host><:port>format.To connect to a replica set, you can specify the replica set seed name, and a seed list of set members, in the following format:
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
- --source <NET [interface]>, <FILE [filename]>, <DIAGLOG [filename]>
-
Specifies source material to inspect. Use --source NET
[interface]to inspect traffic from a network interface (e.g.eth0orlo.) Use --source FILE [filename] to read captured packets in pcap format.You may use the --source DIAGLOG [filename] option to read the output files produced by the --diaglog option.
-
--objcheck -
Modifies the behavior to only display invalid BSON objects and nothing else. Use this option for troubleshooting driver development. This option has some performance impact on the performance of mongosniff.
<port>-
Specifies alternate ports to sniff for traffic. By default, mongosniff watches for MongoDB traffic on port 27017. Append multiple port numbers to the end of mongosniff to monitor traffic on multiple ports.
Usage
Use the following command to connect to a mongod or mongos running on port 27017 and 27018 on the localhost interface:
mongosniff --source NET lo 27017 27018
Use the following command to only log invalid BSON objects for the mongod or mongos running on the localhost interface and port 27018, for driver development and troubleshooting:
mongosniff --objcheck --source NET lo 27018
Build mongosniff
To build mongosniff yourself, Linux users can use the following procedure:
- 1.
-
Obtain prerequisites using your operating systems package management software. Dependencies include:
- •
-
libpcap- to capture network packets.
- •
-
git- to download the MongoDB source code.
- •
-
sconsand a C++ compiler - to build mongosniff.
- 2.
-
Download a copy of the MongoDB source code using
git:git clone git://github.com/mongodb/mongo.git
- 3.
-
Issue the following sequence of commands to change to the
mongo/directory and build mongosniff:cd mongoscons mongosniff
- Note
-
If you run scons mongosniff before installing
libpcapyou must run scons clean before you can build mongosniff.
History
- Debian 9 (Stretch) to Debian 8 (Jessie): the text shown here
- Debian 7 (Wheezy) to Debian 6.0 (Squeeze)
--objcheck since Debian 8 (Jessie).
--source until Debian 7 (Wheezy).