netsnmp 用mfd创建模板后,可以get不能set 

发布于 2021-11-25 06:47:25 字数 474 浏览 748 评论 5

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

残花月 2021-11-27 21:15:30

嗨,您好。能说下你扩展节点的整个过程嘛?

平定天下 2021-11-27 20:41:54

[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))

仔细分析发现应该去了!

输什么也不输骨气 2021-11-27 08:46:58

rwcommunity public  localhost

rwcommunity secret

应该只要这两个就可以吧?

配置文件目前还没搞懂

我只修改了xxx_data_access.c中的demoIpTable_container_load()函数。是不是还要改其他的?

无声静候 2021-11-27 04:24:25

配置文件如下:

用 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

想挽留 2021-11-25 11:38:38

community   是否设置正确?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文