Monitor MongoDB Windows with SNMP使用SNMP监控MongoDB窗口

On this page本页内容

Note注意
Enterprise Feature企业版功能

SNMP is only available in MongoDB Enterprise.SNMP仅在MongoDB企业版中可用。

Overview概述

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支持。

Tip提示
See also: 参阅:

Considerations考虑因素

  • SNMP support is only available in exe. SNMP支持仅在exe中可用。Other MongoDB tools such as exe do not support SNMP.其他MongoDB工具(如exe)不支持SNMP。
  • exe does not support the use of SNMP traps.不支持使用SNMP陷阱。

Configuration Files配置文件

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 exe as the SNMP subagent. 要作为SNMP子代理运行exe的配置文件。This file sets SNMP run-time configuration options, including the AgentX socket to connect to the SNMP master.此文件设置SNMP运行时配置选项,包括用于连接到SNMP主机的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运行时配置选项。

Procedure过程

1

Copy configuration files.复制配置文件。

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 agentXAddress specified in the SNMP configuration file for MongoDB matches the agentXAddress in the SNMP master configuration file.确保SNMP agentXAddress配置文件中指定的SNMP agentXAddress与主配置中的SNMP agentXAddress匹配。

2

Start MongoDB.启动MongoDB。

Start exe with the snmp-subagent to send data to the SNMP master.使用snmp-subagent启动exe以将数据发送到snmp主机。

mongod.exe --snmp-subagent
3

Confirm SNMP data retrieval.确认SNMP数据检索。

Use snmpwalk to collect data from exe:使用snmpwalkexe收集数据:

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 snmpwalk client. 安装net-snmp软件包以访问snmpwalk客户端。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用于客户端通信的主端口

Optional: Run MongoDB as SNMP Master可选:将MongoDB作为SNMP主机运行

You can run exe with the snmp-master option for testing purposes. 出于测试目的,可以使用snmp-master选项运行exeTo 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
←  Monitor MongoDB With SNMP on LinuxTroubleshoot SNMP →