On this page本页内容
SNMP is only available in MongoDB Enterprise.SNMP仅在MongoDB企业版中可用。
MongoDB Enterprise can provide database metrics via SNMP, in support of centralized data collection and aggregation. MongoDB Enterprise可以通过SNMP提供数据库指标,以支持集中的数据集合和聚合。This procedure explains the setup and configuration of a 本过程介绍了将exe
instance as an SNMP subagent, as well as initializing and testing of SNMP support with MongoDB Enterprise.exe
实例设置和配置为SNMP子代理,以及使用MongoDB Enterprise初始化和测试SNMP支持。
Monitor MongoDB With SNMP on Linux and Troubleshoot SNMP for more information.在Linux上使用SNMP监控MongoDB,以及对SNMP进行故障排除以了解更多信息。
MongoDB Enterprise contains the following configuration files to support SNMP:MongoDB Enterprise包含以下支持SNMP的配置文件:
MONGOD-MIB.txt
:
The management information base (MIB) file that defines MongoDB's SNMP output.定义MongoDB的SNMP输出的管理信息库(MIB)文件。
mongod.conf.subagent
:
The configuration file to run 要作为SNMP子代理运行exe
as the SNMP subagent. exe
的配置文件。This file sets SNMP run-time configuration options, including the 此文件设置SNMP运行时配置选项,包括用于连接到SNMP主机的AgentX
socket to connect to the SNMP master.AgentX
套接字。
mongod.conf.master
:
The configuration file to run 将exe
as the SNMP master. exe
作为SNMP主机运行的配置文件。This file sets SNMP run-time configuration options.此文件设置SNMP运行时配置选项。
Use the following sequence of commands to move the SNMP configuration files to the SNMP service configuration directory.使用以下命令序列将SNMP配置文件移动到SNMP服务配置目录。
First, create the SNMP configuration directory if needed and then, from the installation directory, copy the configuration files to the SNMP service configuration directory:首先,如果需要,创建SNMP配置目录,然后从安装目录将配置文件复制到SNMP服务配置目录:
md C:\snmp\etc\config copy MONGOD-MIB.txt C:\snmp\etc\config\MONGOD-MIB.txt copy mongod.conf.subagent C:\snmp\etc\config\mongod.conf
The configuration filename is tool-dependent. 配置文件名取决于工具。For example, when using 例如,使用net-snmp
the configuration file is snmpd.conf
.net-snmp
时,配置文件为snmpd.conf
。
Edit the configuration file to ensure that the communication between the agent (i.e. 编辑配置文件,确保代理(即snmpd
or the master) and sub-agent (i.e. MongoDB) uses TCP.snmpd
或主代理)和子代理(即MongoDB)之间的通信使用TCP。
Ensure that the 确保SNMP agentXAddress
specified in the SNMP configuration file for MongoDB matches the agentXAddress
in the SNMP master configuration file.agentXAddress
配置文件中指定的SNMP agentXAddress
与主配置中的SNMP agentXAddress
匹配。
Start 使用exe
with the snmp-subagent
to send data to the SNMP master.snmp-subagent
启动exe
以将数据发送到snmp主机。
mongod.exe --snmp-subagent
Use 使用snmpwalk
to collect data from exe
:snmpwalk
从exe
收集数据:
Connect an SNMP client to verify the ability to collect SNMP data from MongoDB.连接SNMP客户端以验证从MongoDB集合SNMP数据的能力。
Install the net-snmp package to access the 安装net-snmp软件包以访问snmpwalk客户端。snmpwalk
client. net-snmp
provides the 提供snmpwalk
SNMP client.snmpwalk
SNMP客户端。
snmpwalk -m C:\snmp\etc\config\MONGOD-MIB.txt -v 2c -c mongodb 127.0.0.1:<port> 1.3.6.1.4.1.34601
<port>
refers to the port defined by the SNMP master, not the primary port
used by exe
for client communication.<port>
指的是SNMP主机定义的端口,而不是exe
用于客户端通信的主端口。
You can run 出于测试目的,可以使用exe
with the snmp-master
option for testing purposes. snmp-master
选项运行exe
。To do this, use the SNMP master configuration file instead of the subagent configuration file. 为此,请使用SNMP主配置文件而不是子代理配置文件。From the directory containing the unpacked MongoDB installation files:从包含未打包MongoDB安装文件的目录:
copy mongod.conf.master C:\snmp\etc\config\mongod.conf
Additionally, start 此外,使用exe
with the snmp-master
option, as in the following:snmp-master
启动exe
,如下所示:
mongod.exe --snmp-master