netsnmp 用mfd创建模板后,可以get不能set
snmpget -v 2c -c secret 10.170.16.21 NTCIP1202-2004::phaseConcurrency.3
NTCIP1202-2004::phaseConcurrency.3 = STRING: "Hello world"
snmpset -v 2c -c secret 10.170.16.21 NTCIP1202-2004::phaseConcurrency.3 s "wyg"
Error in packet.Reason: notWritable (That object does not support modification)
Failed object: NTCIP1202-2004::phaseConcurrency.3
phaseConcurrency在mib中是read-write
请教怎么用set get命令动态地在表中添加或者删除行?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
嗨,您好。能说下你扩展节点的整个过程嘛?
[root
@localhost mibs]# snmpset -v2c -c public 192.168.11.129 1.3.6.1.4.1.12345.1.1.1 .2.0 s 192.168.1.1
Error in packet.
Reason: noAccess
Failed object: STEVE-TEST-MIB::demoIpAddress.0
此问题已经解决,原因是mib2c.mfd.conf产生了错误代码
在产生的代码demoIpTable_interface.c 中_demoIpTable_initialize_interface(demoIpTable_registration * reg_ptr, u_lo ng flags)函数中:
[code=c]reginfo = netsnmp_handler_registration_create("demoIpTable", handler,
demoIpTable_oid,
demoIpTable_oid_size,
HANDLER_CAN_BABY_STEP |
#if (defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPO RT))
//注意上面这行出了错,上面是已经改过来了的,原来是#if! (defined(....)|| defined())
HANDLER_CAN_RONLY
#else
HANDLER_CAN_RWRITE
#endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */
);[/code]
这是对的: #if (defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPO RT))
原版是: #if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPO RT))
仔细分析发现应该去了!
rwcommunity public localhost
rwcommunity secret
应该只要这两个就可以吧?
配置文件目前还没搞懂
我只修改了xxx_data_access.c中的demoIpTable_container_load()函数。是不是还要改其他的?
配置文件如下:
用 secret
###############################################################################
#
# EXAMPLE.conf:
# An example configuration file for configuring the Net-SNMP agent ('snmpd')
# See the 'snmpd.conf(5)' man page for details
#
# Some entries are deliberately commented out, and will need to be explicitly activated
#
###############################################################################
#
# AGENT BEHAVIOUR
#
# Listen for connections from the local system only
agentAddress udp:127.0.0.1:161
agentAddress udp:10.170.16.21:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
#agentAddress udp:161,udp6:[::1]:161
###############################################################################
#
# SNMPv3 AUTHENTICATION
#
# Note that these particular settings don't actually belong here.
# They should be copied to the file /var/net-snmp/snmpd.conf
# and the passwords changed, before being uncommented in that file *only*.
# Then restart the agent
# createUser authOnlyUser MD5 "remember to change this password"
# createUser authPrivUser SHA "remember to change this one too" DES
# createUser internalUser MD5 "this is only ever used internally, but still change the password"
# If you also change the usernames (which might be sensible),
# then remember to update the other occurances in this example config file to match.
###############################################################################
#
# ACCESS CONTROL
#
# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
view all included .1
#view all include .1.3.6.1.4.1.1206.4.2.3
# Full access from the local host
rwcommunity public localhost
# Default access to basic system info
rocommunity public default -V systemonly
# Full access from an example network
# Adjust this network address to match your local
# settings, change the community string,
# and check the 'agentAddress' setting above
rwcommunity secret
# Full read-only access for SNMPv3
rouser authOnlyUser
# Full write access for encrypted requests
# Remember to activate the 'createUser' lines above
community 是否设置正确?