我一直在尝试通过 SNMP 获取自定义 MIB 的值
这是我的自定义 MIB:
MY-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, Integer32, enterprises
FROM SNMPv2-SMI
;
psutest MODULE-IDENTITY
LAST-UPDATED "201411250000Z"
ORGANIZATION "UW - System"
CONTACT-INFO "Bob"
DESCRIPTION "MIB for project"
::={ enterprises 214}
currentScalar OBJECT IDENTIFIER ::= { psutest 2}
voltageScalar OBJECT IDENTIFIER ::= { psutest 3}
currentScalar OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION "A simple object that holds the current current as a simple integer"
::= { psutest 2}
voltageScalar OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION "A simple object that holds the current voltage reading as a single integer"
::= { psutest 3}
END
现在当我snmpget -v2c -c public localhost currentScalar.0
这样做时,它会返回MY-MIB::currentScalar.0 = No Such Object available on this agetn at this OID
。我已经通过以下方式加载了 MIBNet-snmp 网站上的教程 查看微软的这个 MIB 示例,我觉得我可能在以下几行上做错了:
currentScalar OBJECT IDENTIFIER ::= { psutest 2}
voltageScalar OBJECT IDENTIFIER ::= { psutest 3}
我的 snmpd.conf 文件非常简单:
agentAddress udp:161
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
rocommunity public efault .1.3.6.1
...
some system information stuff and active monitoring I haven't touched
...
extend .1.3.6.1.4.1.214.2 /home/pi/networking/supply.sh
master agentx
我是否缺少整个对象定义或者其他东西?