3

MIB OID 对象具有数据类型“位”:

object_OID
Composed Type: Bits
Base Type: BITS
Access: read-write
Kind: Scalar
SMI Type: OBJECT-TYPE
Value List: 
doc (0)
emta (1)
cpe (2)

根据 MIB 描述,默认为 DEFVAL { '00'h }。我想要设置值 2 (cpe)。我试图用命令设置值

snmpset -v2c -c public 192.168.100.1  [object_OID] b 2

但得到了

Error in packet.
Reason: wrongValue (The set value is illegal or unsupported in some way)

也试过

snmpset -v2c -c public 192.168.100.1  [object_OID] i 2

再次出错

Error in packet.
Reason: wrongType (The set datatype does not match the data type the agent expects)

针对此对象的 Snmpget 返回Hex-STRING: 00 为 BITS 数据类型设置值 2 的正确格式是什么?

4

2 回答 2

2

You're using the correct syntax to set a BITS value. I would hazard a guess that the agent implementation is faulty (i.e. the agent is not following the MIB definition).

于 2014-09-17T14:09:09.660 回答
1

Net-SNMP 的正确语法是:

snmpset -v2c -c public 192.168.100.1   $ObjectId   = 'emta cpe'
于 2019-05-22T08:05:15.597 回答