snmpwalk 没有看到 mib

snmpwalk 没有看到 mib

使用 Ubuntu 15.10 时遇到一个奇怪的问题。昨天,由于系统更新,我不得不重新启动,重新启动后,我使用的 2 个 MIB - LM-SENSORS-MIB 和 UCD-DISKIO-MIB 在 snmpwalk 中不起作用。我仍然可以使用 snmptranslate 找到 OID,它安装在 /usr/share/snmp/mibs 中。

snmptranslate -IR -On LM-SENSORS-MIB::lmTempSensorsValue.6
.1.3.6.1.4.1.2021.13.16.2.1.3.6

^ 可以找到 OID,但是除了我输入的内容之外,下面没有找到任何内容:

snmpwalk localhost . | grep lmTemp
HOST-RESOURCES-MIB::hrSWRunParameters.28399 = STRING: "--color=auto lmTemp"

它也没有看到 OID:

snmpwalk localhost . | grep 2021.13.16.2.1.3.6

已验证其已安装:

ls /usr/share/snmp/mibs/LM*
/usr/share/snmp/mibs/LM-SENSORS-MIB.txt

/etc/default/snmp 的内容:

cat /etc/default/snmpd
# This file controls the activity of snmpd

# Don't load any MIBs by default.
# You might comment this lines once you have the MIBs downloaded.
#export MIBS=

# snmpd control (yes means start daemon).
SNMPDRUN=yes

# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u root -g 0 -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'

注意 - 我在 /etc/snmp/snmpd.conf 文件中确实有 mibs +ALL。

答案1

我发现我无法列出 LM-SENSORS-MIB 的任何内容,直到我/etc/snmp/snmpd.conf通过添加以下内容放宽了权限:

rocommunity public  localhost

重新启动 snmpd 后,service snmpd restart以下命令终于起作用了:

snmpwalk -v2c -c public localhost .  | grep 2021.13.16.2.1.3.6
> iso.3.6.1.2.1.25.4.2.1.5.25917 = STRING: "2021.13.16.2.1.3.6"

snmpwalk -v2c -c public localhost LM-SENSORS-MIB::lmTempSensorsTable
> LM-SENSORS-MIB::lmTempSensorsIndex.7 = INTEGER: 7
> ...

相关内容