我试图让 Net-SNMP 向我提供其配置的 snmpEngineID,即使它看起来就在那里,但我无法访问 snmpV2 MIB 中的任何内容。
我有一台 CentOS 7 服务器,已从 RHeL 存储库安装了 Net-SNMP,我需要对其进行设置,以便远程管理服务器可以使用 SNMPv3 对其进行监控,为此我需要 snmpEngineID。
安装顺利并且守护进程正常工作:
# snmpwalk -v 2c -c public localhost system.sysContact
SNMPv2-MIB::sysContact.0 = STRING: Martin <[email protected]>
#
但是,当我尝试检索 snmpEngineID 时,它失败了:
# snmpwalk -v 2c -c public localhost SNMP-FRAMEWORK-MIB::snmpEngineID
SNMP-FRAMEWORK-MIB::snmpEngineID = No more variables left in this MIB View (It is past the end of the MIB tree)
#
在对 snmpget 命令进行完整调试(-D all)时,我得到了以下信息:
...
trace: snmp_parse_var_op(): snmp.c, 164:
dumph_recv: Name
dumpx_recv: 06 0A 2B 06 01 06 03 0A 02 01 01 00
dumpv_recv: ObjID: SNMP-FRAMEWORK-MIB::snmpEngineID.0
trace: snmp_pdu_parse(): snmp_api.c, 4530:
dumph_recv: Value
trace: _sess_process_packet(): snmp_api.c, 5245:
sess_process_packet: received message id#0 reqid#1594114350 len 45
trace: snmp_synch_input(): snmp_client.c, 183:
snmp_synch: Response (ReqID: 1594114350 - Cmd 162)
SNMP-FRAMEWORK-MIB::snmpEngineID.0 = No Such Object available on this agent at this OID
#
尽管 snmpwalk() 应该可以工作,但我尝试了直接 snmpget() 到输出中提供的 objID:
# snmpget -v 2c -c public localhost ObjID: SNMP-FRAMEWORK-MIB::snmpEngineID.0
MIB search path: /usr/local/nom/share/snmp/mibs:/usr/local/nom/share/snmp/mibs
Cannot find module (ObjID): At line 0 in (none)
ObjID:: Unknown Object Identifier
#
如您所见,这也失败了。
I think that "06 0A 2B 06 01 06 03 0A 02 01 01 00" provided in the debug output is the actual engine ID but I do't want to take that as gospel and, more importantly, I want to know why the snmpwalk and snmpget commands I am trying are failing.
I did try the OID itself, in case there were issues with the MIB file but it also failed:
# snmpget -v 2c -c public localhost .1.3.6.1.6.3.10.2.1.1.0
SNMP-FRAMEWORK-MIB::snmpEngineID.0 = No Such Object available on this agent at this OID
#
I then tried working back through the OID, walking each number. They all failed until I got to to .1.3.6.1
# snmpwalk -v 2c -c public localhost .1.3.6.1.6 | head -1
SNMPv2-SMI::snmpV2 = No more variables left in this MIB View (It is past the end of the MIB tree)
# snmpwalk -v 2c -c public localhost .1.3.6.1 | head -1
SNMPv2-MIB::sysDescr.0 = STRING: Linux 143-42-69-251.ip.linodeusercontent.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
#
.1.3.6.1.6 is the snmpV2-SMI MIB but I am at a loss to understand why this MIB is not being reported back on.
Has anyone come across this? I'm guessing it's something basic, but I certainly cannot see what or where that might be.
Your assistance is much appreciated.