1- .. include:: header.tmpl
1+ ======================
2+ MongoDB SNMP Extension
3+ ======================
24
3- ==================================
4- MongoDB SNMP Support Documentation
5- ==================================
5+ .. versionadded:: 2.2
6+
7+ .. admonition:: Subscriber Only Feature
8+
9+ This feature is only available in the Subscriber Edition of
10+ MongoDB.
611
712This document outlines the use and operation of MongoDB's SNMP
813extension, which is is only available in the `MongoDB Subscriber Edition
9- <http://www.10gen.com/mongodb-subscriber-edition-download>`_
10- (https://www.10gen.com/mongodb-subscriber-edition-download).
14+ <http://www.10gen.com/mongodb-subscriber-edition-download>`_.
1115
12- MongoDB Installation
13- --------------------
16+ Install MongoDB Subscriber Edition
17+ ----------------------------------
1418
1519The MongoDB Subscriber Edition (including SSL and SNMP functionality) is
16- available on four platforms. See the page on the `subscriber edition
17- <https://www.10gen.com/mongodb-subscriber-edition-download>`_ for more
18- information.
20+ available on four platforms. For more information, see `MongoDB
21+ Subscriber Edition <http://www.10gen.com/mongodb-subscriber-edition-download>`_.
1922
2023Included Files
2124--------------
2225
23- The subscriber edition contains the following files:
26+ The Subscriber Edition contains the following files:
2427
2528- ``MONGO-MIB.txt``:
2629
@@ -31,138 +34,147 @@ The subscriber edition contains the following files:
3134
3235 The SNMP configuration file for reading the SNMP output of
3336 MongoDB. The SNMP configures the community names, permissions,
34- access controls etc.
37+ access controls, etc.
3538
3639Required Packages
3740-----------------
3841
3942To use SNMP, you must install several prerequisites. The names of the
40- pacakges vary by distribution, and are as follows:
43+ pacakges vary by distribution and are as follows:
4144
42- - * Ubuntu 11.04* requires ``libssl0.9.8``, ``snmp-mibs-downloader``,
43- ``snmp``, and ``snmpd``. Issue a command that resembles the
44- following to install these packages: ::
45+ - Ubuntu 11.04 requires ``libssl0.9.8``, ``snmp-mibs-downloader``,
46+ ``snmp``, and ``snmpd``. Issue a command such as the
47+ following to install these packages:
4548
46- sudo apt-get install libssl0.9.8 snmp snmpd snmp-mibs-downloader
49+ .. code-block:: sh
4750
48- - *Red Hat Enterprise Linux 6.x series and Amazon Linux AMI* require:
49- ``libssl``, ``net-snmp``, ``net-snmp-libs``, and ``net-snmp-utils``.
51+ sudo apt-get install libssl0.9.8 snmp snmpd snmp-mibs-downloader
5052
51- .. ``libssl.so.10``, ``net-snmp-5.5-37.9.amzn1.x86_64``, ``net-snmp-libs-5.5-37.9.amzn1.x86_64``
52- ``net-snmp-utils-5.5-37.9.amzn1.x86_64``
53+ - Red Hat Enterprise Linux 6.x series and Amazon Linux AMI require
54+ ``libssl``, ``net-snmp``, ``net-snmp-libs``, and ``net-snmp-utils``.
55+ Issue a command such as the following to install these packages:
5356
54- Issue a command that resembles the following to
55- install these packages: ::
57+ .. code-block:: sh
5658
57- sudo yum install libssl net-snmp net-snmp-libs net-snmp-utils
59+ sudo yum install libssl net-snmp net-snmp-libs net-snmp-utils
5860
5961- SUSE Enterprise Linux requires ``libopenssl0_9_8``, ``libsnmp15``,
60- ``slessp1-libsnmp15``, and ``snmp-mibs``. Issue a command that
61- resembles the following to install these packages: : :
62+ ``slessp1-libsnmp15``, and ``snmp-mibs``. Issue a command such as the
63+ following to install these packages:
6264
63- sudo zypper install libopenssl0_9_8 libsnmp15 slessp1-libsnmp15 snmp-mibs
65+ .. code-block:: sh
66+
67+ sudo zypper install libopenssl0_9_8 libsnmp15 slessp1-libsnmp15 snmp-mibs
6468
6569Install MIB Configuration Files
6670-------------------------------
6771
68- Ensure that the MIB directory, at ``/usr/share/snmp/mibs`` exits, by
69- issuing the following command: ::
72+ Ensure that the MIB directory, at ``/usr/share/snmp/mibs`` exists. If
73+ not, issue the following command:
74+
75+ .. code-block:: sh
76+
77+ sudo mkdir -p /usr/share/snmp/mibs
7078
71- sudo mkdir -p /usr/share/snmp/mibs
79+ Use the following command to create a symbolic link:
7280
73- Use the following command to create a symbolic link: ::
81+ .. code-block:: sh
7482
75- sudo ln -s [/path/to/mongodb/distribution/]MONGO-MIB.txt /usr/share/snmp/mibs/
83+ sudo ln -s [/path/to/mongodb/distribution/]MONGO-MIB.txt /usr/share/snmp/mibs/
7684
7785Replace ``[/path/to/mongodb/distribution/]`` with the path to your
7886``MONGO-MIB.txt`` configuration file.
7987
80- Finally the ``mongod.conf`` file into the ``/etc/snmp`` directory
81- with the following command: ::
88+ Copy the ``mongod.conf`` file into the ``/etc/snmp`` directory
89+ with the following command:
8290
83- cp mongod.conf /etc/snmp/mongod.conf
91+ .. code-block:: sh
8492
85- Replace ``[/path/to/mongodb/distribution/]`` with the path to your
86- ``mongod.conf`` file.
93+ cp mongod.conf /etc/snmp/mongod.conf
8794
8895Start Up
8996--------
9097
91- You can control the subscriber edition of MongoDB as any other
92- ``mongod``, using default or custom or control scripts.
98+ You can control the Subscriber Edition of MongoDB using default or
99+ custom or control scripts, just as you can any other :program:`mongod`:
93100
94101Use the following command to view all SNMP options available in your
95- MongoDB: ::
102+ MongoDB:
96103
97- mongod --help | grep snmp
104+ .. code-block:: sh
98105
99- The above command should return the following output: ::
106+ mongod --help | grep snmp
100107
101- Module snmp options:
102- --snmp-subagent run snmp subagent
103- --snmp-master run snmp as master
108+ The above command should return the following output:
104109
105- Ensure that the ``/data/db/`` (i.e. the path where MongoDB stores the
106- data files.) and ``/var/log/mongodb/`` (i.e. the path where MongoDB
107- writes the log output) exist, by issuing the following command: ::
110+ .. code-block:: sh
108111
109- mkdir -p /var/log/mongodb/ /data/db/
112+ Module snmp options:
113+ --snmp-subagent run snmp subagent
114+ --snmp-master run snmp as master
110115
111- Start the ``mongod`` instance with the following command: : :
116+ Ensure that the following directories exist :
112117
113- mongod --snmp-master --port 3001 --fork --dbpath / data/db/ --logpath /var/log/mongodb/1.log
118+ - ``/data/db/`` (This is the path where MongoDB stores the data files.)
114119
115- You may set all of these options in a `configuration file`_ at your
116- discretion.
120+ - ``/var/log/mongodb/`` (This is the path where MongoDB writes the log
121+ output.)
117122
118- To check if ``mongod`` is running with SNMP support, issue the
119- following command: ::
123+ If they do not, issue the following command:
120124
121- ps -ef | grep 'mongod --snmp'
125+ .. code-block:: sh
122126
123- The command should return output that includes the following
124- line. This indicates that the proper ``mongod`` instance is running: ::
127+ mkdir -p /var/log/mongodb/ /data/db/
125128
126- systemuser 31415 10260 0 Jul13 pts/16 00:00:00 mongod --snmp-master --port 3001 # [...]
129+ Start the :program:` mongod` instance with the following command:
127130
128- .. _`configuration file`: http://docs.mongodb.org/manual/reference/configuration-options/
131+ .. code-block:: sh
129132
130- .. raw:: latex
133+ mongod --snmp-master --port 3001 --fork --dbpath /data/db/ --logpath /var/log/mongodb/1.log
131134
132- \newpage
135+ Optionally, you can set these options in a :doc:`configuration file
136+ </reference/configuration-options>`.
133137
134- Troubleshooting
135- ---------------
138+ To check if :program:`mongod` is running with SNMP support, issue the
139+ following command:
140+
141+ .. code-block:: sh
136142
137- Always check the logs for errors if something doesn't run as
138- expected, see the log at ``/var/log/mongodb/1.log``. The presence of
139- the following line: ::
143+ ps -ef | grep 'mongod --snmp'
140144
141- [SNMPAgent] warning: error starting SNMPAgent as master err:1
145+ The command should return output that includes the following
146+ line. This indicates that the proper :program:`mongod` instance is running:
147+
148+ .. code-block:: sh
142149
143- indicates that the ``mongod`` cannot read the
144- ``/etc/snmp/mongod.conf`` file.
150+ systemuser 31415 10260 0 Jul13 pts/16 00:00:00 mongod --snmp-master --port 3001 # [...]
145151
146- Initial Testing
152+ Test the Set Up
147153---------------
148154
149- Check for the snmp agent process listening on port 1161 with the
155+ Check for the snmp agent process listening on port `` 1161`` with the
150156following command: ::
151157
152158 sudo lsof -i :1161
153159
154- which return the following output: ::
160+ which return the following output:
161+
162+ .. code-block:: sh
163+
164+ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
165+ mongod 9238 sysadmin 10u IPv4 96469 0t0 UDP localhost:health-polling
155166
156- COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
157- mongod 9238 sysadmin 10u IPv4 96469 0t0 UDP localhost:health-polling
167+ Similarly, this command:
158168
159- Similarly, the next command: ::
169+ .. code-block:: sh
160170
161- netstat -an | grep 1161
171+ netstat -an | grep 1161
162172
163- should return the following output: ::
173+ should return the following output:
164174
165- udp 0 0 127.0.0.1:1161 0.0.0.0:*
175+ .. code-block:: sh
176+
177+ udp 0 0 127.0.0.1:1161 0.0.0.0:*
166178
167179Run ``snmpwalk`` Locally
168180------------------------
@@ -171,14 +183,30 @@ Run ``snmpwalk`` Locally
171183according to the MIB. If you installed all of the required packages
172184above, your system will have ``snmpwalk``.
173185
174- Issue the following command to collect data from ``mongod`` using
175- SNMP: ::
186+ Issue the following command to collect data from :program:`mongod` using
187+ SNMP:
188+
189+ .. code-block:: sh
190+
191+ snmpwalk -m MONGO-MIB -v 2c -c mongodb 127.0.0.1:1161 1.3.6.1.4.1.37601
176192
177- snmpwalk -m MONGO-MIB -v 2c -c mongodb 127.0.0.1:1161 1.3.6.1.4.1.37601
193+ You may also choose to specify a the path to the MIB file:
178194
179- You may also choose to specify a the path to the MIB file: ::
195+ .. code-block:: sh
180196
181- snmpwalk -m /usr/share/snmp/mibs/MONGO-MIB -v 2c -c mongodb 127.0.0.1:1161 1.3.6.1.4.1.37601
197+ nmpwalk -m /usr/share/snmp/mibs/MONGO-MIB -v 2c -c mongodb 127.0.0.1:1161 1.3.6.1.4.1.37601
182198
183199Use this command *only* to ensure that you can retrieve and validate
184200SNMP data from MongoDB.
201+
202+ Troubleshooting
203+ ---------------
204+
205+ Always check the logs for errors if something does not run as expected,
206+ see the log at ``/var/log/mongodb/1.log``. The presence of the following
207+ line indicates that the :program:`mongod` cannot read the
208+ ``/etc/snmp/mongod.conf`` file:
209+
210+ .. code-block:: sh
211+
212+ [SNMPAgent] warning: error starting SNMPAgent as master err:1
0 commit comments