发出以下命令时,标题中出现错误。
$ snmpget -v3 -u edgeos-snmpd-user -l authPriv -a SHA -x AES -A authPhrase -X privPhrase 192.168.x.x hrSystemUptime.0
hrSystemUptime.0: Unknown Object Identifier (Sub-id not found: (top) -> hrSystemUptime)
如果我在目标系统 (192.168.xx) 上输入相同的命令,我会得到一个有效的结果。
# snmpget -v3 -u edgeos-snmpd-user -l authPriv -a SHA -x AES -A authPhrase -X privPhrase localhost hrSystemUptime.0
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (1362660) 3:47:06.60
客户端是基于 Ubuntu 18.04.1 的 Docker 容器,目标是基于 Alpine 的 Linux 设备。
我已经安装snmp-mibs-downloader
在容器中并且hrSystemUptime
条目存在于"/var/lib/snmp/mibs/ietf/HOST-RESOURCES-MIB
.
-- The Host Resources System Group
hrSystemUptime OBJECT-TYPE
SYNTAX TimeTicks
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The amount of time since this host was last
initialized. Note that this is different from
sysUpTime in the SNMPv2-MIB [RFC1907] because
sysUpTime is the uptime of the network management
portion of the system."
::= { hrSystem 1 }
但是,它似乎没有搜索此目录。
$ net-snmp-config --default-mibdirs
/home/edge/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
我复制HOST-RESOURCES-MIB
到/home/edge/.snmp/mibs
但没有任何区别。
我必须在容器中做什么才能使其正常工作?