我有一个快速的问题。它最有可能是用户错误,所以我在开始之前道歉。
我正在尝试为设备设置阈值,以便当我们的一台打印机处于某种状态时它会提醒我们。(卡住、碳粉用完、无纸等)我找到了处理此问题的特定 oid。(1.3.6.1.2.1.25.3.5.1.2.1) 具体的oid在HOST-RESOURCE-MIB下叫做hrPrinterDetectedErrorState。我已经验证我可以通过 SNMPWALK 看到 oid。我的问题是解释它吐出的数据。我在 MIB 中阅读的内容和我通过 SNMPWALK 看到的内容是不同的。
以下是 MIB 中对 oid 的描述:
"This object represents any error conditions detected
by the printer. The error conditions are encoded as
bits in an octet string, with the following
definitions:
Condition Bit #
lowPaper 0
noPaper 1
lowToner 2
noToner 3
doorOpen 4
jammed 5
offline 6
serviceRequested 7
inputTrayMissing 8
outputTrayMissing 9
markerSupplyMissing 10
outputNearFull 11
outputFull 12
inputTrayEmpty 13
overduePreventMaint 14
Bits are numbered starting with the most significant
bit of the first byte being bit 0, the least
significant bit of the first byte being bit 7, the
most significant bit of the second byte being bit 8,
and so on. A one bit encodes that the condition was
detected, while a zero bit encodes that the condition
was not detected.
This object is useful for alerting an operator to
specific warning or error conditions that may occur,
especially those requiring human intervention."
奇怪的是 SNMPWALK 说 oid 是一个十六进制字符串,而 MIB 指定它应该是一个八进制字符串。两者有区别吗?我是否需要以某种方式转换 SNMPWALK 输出的数据以使其与 MIB 所说的相匹配?
为了测试一切,我将打印机置于几个不同的“状态”。然后我在设备上运行 SNMPWALK 以查看 oid 输出。这是结果。正如您将看到的,这些结果与 MIB 指定的不匹配。
Case 1: Opened the toner door
Expected Output based on MIB: 4
SNMP Output: 08
Case 2: Removed Toner & Closed the door
Expected Output based on MIB: 1
SNMP Output: 10
Case 3: Placed 1 sheet of paper and printed a 2 page document. The printer ran out of paper.
Expected Output based on MIB: 0 or 1
SNMP Output: @
我对输出感到困惑。我只需要知道如何读取 oid,这样我就可以设置阈值,以便当它看到例如 08 时,它会执行某个操作。
谢谢你的帮助!