Troubleshoot SNMPSNMP故障排除

On this page本页内容

Note注意
Enterprise Feature企业版功能

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

MongoDB Enterprise on macOS does not include support for SNMP due to SERVER-29352.由于服务器为29352,macOS上的MongoDB Enterprise不支持SNMP。

Overview概述

MongoDB Enterprise can provide database metrics via SNMP, in support of centralized data collection and aggregation. MongoDB Enterprise可以通过SNMP提供数据库指标,以支持集中的数据集合和聚合。This document identifies common problems you may encounter when deploying MongoDB Enterprise with SNMP as well as possible solutions for these issues.本文档介绍了使用SNMP部署MongoDB Enterprise时可能遇到的常见问题,以及这些问题的可能解决方案。

See Monitor MongoDB With SNMP on Linux and Monitor MongoDB Windows with SNMP for complete installation instructions.有关完整的安装说明,请参阅Linux上使用SNMP监控MongoDB使用SNMP监控MongoDB Windows

Issues问题

Failed Global Initialization全局初始化失败

If you receive the following error message when trying to monitor with SNMP:如果尝试使用SNMP进行监视时收到以下错误消息:

<Timestamp> F CONTROL [main] Failed global initialization: Bad Value: snmp.subagent is not allowed when snmp.disabled is specified

Ensure that you have not disabled SNMP access to mongod.确保未禁用对mongod的SNMP访问

By default, SNMP access to mongod instances is enabled. 默认情况下,会启用对mongod实例的SNMP访问。Starting in MongoDB 4.0.6, you can disable SNMP access using either command-line option --snmp-disabled or the configuration file option snmp.disabled.从MongoDB 4.0.6开始,可以使用命令行选项--snmp-disabled或配置文件选项snmp.disabled来禁用SNMP访问。

Failed to Connect无法连接

The following in the mongod logfile:mongod日志文件中包含以下内容:

Warning: Failed to connect to the agentx master agent

AgentX is the SNMP agent extensibility protocol defined in Internet RFC 2741. AgentX是Internet RFC 2741中定义的SNMP代理扩展协议。It explains how to define additional data to monitor over SNMP. 它解释了如何定义通过SNMP监控的附加数据。When MongoDB fails to connect to the agentx master agent, use the following procedure to ensure that the SNMP subagent can connect properly to the SNMP master.当MongoDB无法连接到agentx主代理时,请使用以下过程确保SNMP子代理可以正确连接到SNMP主代理。

  1. Make sure the master agent is running.确保主代理正在运行。
  2. Compare the SNMP master's configuration file with the subagent configuration file. 将SNMP主配置文件与子代理配置文件进行比较。Ensure that the agentx socket definition is the same between the two.确保两者之间的agentx套接字定义相同。
  3. Check the SNMP configuration files to see if they specify using UNIX Domain Sockets. 检查SNMP配置文件,查看它们是否指定使用UNIX域套接字。If so, confirm that the mongod has appropriate permissions to open a UNIX domain socket.如果是,请确认mongod具有打开UNIX域套接字的适当权限。

Error Parsing Command Line分析命令行时出错

One of the following errors at the command line:命令行出现以下错误之一:

Error parsing command line: unknown option snmp-master
try 'mongod --help' for more information
Error parsing command line: unknown option snmp-subagent
try 'mongod --help' for more information

mongod binaries that are not part of the Enterprise Edition produce this error. 不属于企业版的二进制文件会产生此错误。Install the Enterprise Edition and attempt to start mongod again.安装企业版并尝试再次启动mongod

Other MongoDB binaries, including mongos will produce this error if you attempt to start them with snmp-master or snmp-subagent. 如果尝试使用snmp-mastersnmp-subagent启动其他MongoDB二进制文件,包括mongos,将产生此错误。Only mongod supports SNMP.只有mongod支持SNMP。

MongoDB Enterprise on macOS does not include support for SNMP due to SERVER-29352.由于SERVER-29352,macOS上的MongoDB Enterprise不支持SNMP。

Error Starting 启动错误SNMPAgent

The following line in the log file indicates that mongod cannot read the mongod.conf file:日志文件中的以下行表示mongod无法读取mongod.conf文件:

[SNMPAgent] warning: error starting SNMPAgent as master err:1

If running on Linux, ensure mongod.conf exists in the /etc/snmp directory, and ensure that the mongod UNIX user has permission to read the mongod.conf file.如果在Linux上运行,请确保/etc/snmp目录中存在mongod.conf,并确保mongod UNIX用户具有读取mongod.conf文件的权限。

If running on Windows, ensure mongod.conf exists in C:\snmp\etc\config.如果在Windows上运行,请确保C:\snmp\etc\config中存在mongod.conf

←  Monitor MongoDB Windows with SNMPStorage →