1
- .. include:: header.tmpl
1
+ ======================
2
+ MongoDB SNMP Extension
3
+ ======================
2
4
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.
6
11
7
12
This document outlines the use and operation of MongoDB's SNMP
8
13
extension, 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>`_.
11
15
12
- MongoDB Installation
13
- --------------------
16
+ Install MongoDB Subscriber Edition
17
+ ----------------------------------
14
18
15
19
The 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>`_.
19
22
20
23
Included Files
21
24
--------------
22
25
23
- The subscriber edition contains the following files:
26
+ The Subscriber Edition contains the following files:
24
27
25
28
- ``MONGO-MIB.txt``:
26
29
@@ -31,138 +34,147 @@ The subscriber edition contains the following files:
31
34
32
35
The SNMP configuration file for reading the SNMP output of
33
36
MongoDB. The SNMP configures the community names, permissions,
34
- access controls etc.
37
+ access controls, etc.
35
38
36
39
Required Packages
37
40
-----------------
38
41
39
42
To 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:
41
44
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:
45
48
46
- sudo apt-get install libssl0.9.8 snmp snmpd snmp-mibs-downloader
49
+ .. code-block:: sh
47
50
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
50
52
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:
53
56
54
- Issue a command that resembles the following to
55
- install these packages: ::
57
+ .. code-block:: sh
56
58
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
58
60
59
61
- 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:
62
64
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
64
68
65
69
Install MIB Configuration Files
66
70
-------------------------------
67
71
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
70
78
71
- sudo mkdir -p /usr/share/snmp/mibs
79
+ Use the following command to create a symbolic link:
72
80
73
- Use the following command to create a symbolic link: ::
81
+ .. code-block:: sh
74
82
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/
76
84
77
85
Replace ``[/path/to/mongodb/distribution/]`` with the path to your
78
86
``MONGO-MIB.txt`` configuration file.
79
87
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:
82
90
83
- cp mongod.conf /etc/snmp/mongod.conf
91
+ .. code-block:: sh
84
92
85
- Replace ``[/path/to/mongodb/distribution/]`` with the path to your
86
- ``mongod.conf`` file.
93
+ cp mongod.conf /etc/snmp/mongod.conf
87
94
88
95
Start Up
89
96
--------
90
97
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`:
93
100
94
101
Use the following command to view all SNMP options available in your
95
- MongoDB: ::
102
+ MongoDB:
96
103
97
- mongod --help | grep snmp
104
+ .. code-block:: sh
98
105
99
- The above command should return the following output: ::
106
+ mongod --help | grep snmp
100
107
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:
104
109
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
108
111
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
110
115
111
- Start the ``mongod`` instance with the following command: : :
116
+ Ensure that the following directories exist :
112
117
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.)
114
119
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.)
117
122
118
- To check if ``mongod`` is running with SNMP support, issue the
119
- following command: ::
123
+ If they do not, issue the following command:
120
124
121
- ps -ef | grep 'mongod --snmp'
125
+ .. code-block:: sh
122
126
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/
125
128
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:
127
130
128
- .. _`configuration file`: http://docs.mongodb.org/manual/reference/configuration-options/
131
+ .. code-block:: sh
129
132
130
- .. raw:: latex
133
+ mongod --snmp-master --port 3001 --fork --dbpath /data/db/ --logpath /var/log/mongodb/1.log
131
134
132
- \newpage
135
+ Optionally, you can set these options in a :doc:`configuration file
136
+ </reference/configuration-options>`.
133
137
134
- Troubleshooting
135
- ---------------
138
+ To check if :program:`mongod` is running with SNMP support, issue the
139
+ following command:
140
+
141
+ .. code-block:: sh
136
142
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'
140
144
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
142
149
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 # [...]
145
151
146
- Initial Testing
152
+ Test the Set Up
147
153
---------------
148
154
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
150
156
following command: ::
151
157
152
158
sudo lsof -i :1161
153
159
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
155
166
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:
158
168
159
- Similarly, the next command: ::
169
+ .. code-block:: sh
160
170
161
- netstat -an | grep 1161
171
+ netstat -an | grep 1161
162
172
163
- should return the following output: ::
173
+ should return the following output:
164
174
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:*
166
178
167
179
Run ``snmpwalk`` Locally
168
180
------------------------
@@ -171,14 +183,30 @@ Run ``snmpwalk`` Locally
171
183
according to the MIB. If you installed all of the required packages
172
184
above, your system will have ``snmpwalk``.
173
185
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
176
192
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:
178
194
179
- You may also choose to specify a the path to the MIB file: ::
195
+ .. code-block:: sh
180
196
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
182
198
183
199
Use this command *only* to ensure that you can retrieve and validate
184
200
SNMP 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