net-snmp:强制表的 xxEntry 值为 2 而不是 1
使用 net-snmp,由 mib2c -c mib2c.iterate.conf fooBarTable
生成表代码,然后遭到严重黑客攻击。
不幸的是,该表定义的条目为 2,而不是正常的 1。(我没有这样做,我试图使其适合现有情况。)MIB 看起来像这样:
fooBarTable OBJECT-TYPE
SYNTAX SEQUENCE OF FooBarEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "blah"
::= { fooMIBObjects 8 }
fooBarEntry OBJECT-TYPE
SYNTAX FooBarEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "Stuff."
INDEX { ifIndex }
::= { fooBarTable 2 }
当您注册表时使用net-snmp,您只需给它一个OID,如“...,1,8”(即直到fooBarTable,但不包括Entry)。 Net-snmp 隐式地将 .1 附加到表 OID,然后是列、索引等。
是否有半支持的方法将该条目值强制为 2? (即,无需从传递给处理程序的对象中提取位。)
Using net-snmp, table code generated by mib2c -c mib2c.iterate.conf fooBarTable
and then heavily hacked.
Unfortunately the table is defined with an Entry of 2 instead of the normal 1. (I didn't do this, I'm trying to make this fit into an existing situation.) The MIB looks something like this:
fooBarTable OBJECT-TYPE
SYNTAX SEQUENCE OF FooBarEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "blah"
::= { fooMIBObjects 8 }
fooBarEntry OBJECT-TYPE
SYNTAX FooBarEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "Stuff."
INDEX { ifIndex }
::= { fooBarTable 2 }
When you register the table with net-snmp, you just give it an OID like "...,1,8" (i.e. up to fooBarTable, but not including the Entry). Net-snmp implicitly tacks the .1 to the table OID and then columns, indices, etc.
Is there a semi-supported way to force that entry value to 2? (I.e. without resorting to hacking the bits out of the objects that are passed in to the handler.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,抱歉:没有受支持的方法可以做到这一点。部分原因是您所关注的 MIB 在 SMIv2 下不合法。
要实现它,您要么需要更改 agent/helper 目录中的多个位置(从 table.c 的第 328 行附近开始,可能还有其他地方),要么完全从头开始实现一个表,而不使用辅助模块。
但 mib2c 提供的任何内容都无法为您解决这个问题。
No, sorry: there is no supported way to do that. In part because the MIB you're staring at is not legal under SMIv2.
To implement it, you'd either need to change multiple spots in the agent/helper directory (starting near line 328 of table.c and probably other places) or implement a table entirely from scratch without using the helper modules at all.
But nothing mib2c gives you will solve this for you.