SNMP pass\u persist似乎未执行

2024-06-08 02:59:54 发布

您现在位置:Python中文网/ 问答频道 /正文

虽然问题{a1}接近于我正在寻找的答案,但答案是明确的,不完全是我的问题(我认为)

pass\u persist在我的行走中没有输出

我正在使用pip模块https://pypi.org/project/snmp-passpersist/,并使用结果测试示例:

snmpwalk -v2c -c public 192.168.1.### .1.3.6.1.3

SNMPv2-SMI::experimental = No more variables left in this MIB View (It is past the end of the MIB tree)

我的权限是a+x,文件位于/etc/snmp中,因此我的snmpd.conf读作

agentAddress udp:161

createUser authOnlyUser  MD5 "authonlyuser"
createUser authPrivUser  SHA "authprivuser"  DES
createUser internalUser  MD5 "internaluser"

view   enterprise   included   .1.3.6.1.3

rocommunity  public default -V enterprise

pass_persist .1.3.6.1.3.53.8.0 /etc/snmp/test.py

(顺便说一句,我知道3是实验性的,这将更改为4企业)

我的假设与守护进程有关,因为当我运行

python /etc/snmp/test.py 代码运行,我得到了预期的结果

PING返回PONGDUMP返回

{'0.1': {'label': 'This is a label for this integer',
         'type': 'INTEGER',
         'value': '123'},
 '0.2': {'type': 'STRING', 'value': 'A string'},
 '0.3': {'type': 'OCTET', 'value': '01 00 1f 0b 00 0b'}}

我希望在我的步行中也能得到类似的结果

SNMPv2-SMI::experimental.53.8.0.1 = INTEGER: 123
SNMPv2-SMI::experimental.53.8.0.2 = STRING: "A string"
SNMPv2-SMI::experimental.53.8.0.3 = OCTET: 01 00 1f 0b 00 0b

而不是 SNMPv2-SMI::experimental = No more variables left in this MIB View (It is past the end of the MIB tree)

我已经查看了/var/log/syslog和/var/log/messages,并看到了walk的名称 如果我把 extend .1.3.6.1.3.53.9.0 /bin/echo hello在snmpd.conf的末尾(在pass\u persist之后) 我得到了预期的产出

SNMPv2-SMI::experimental.53.9.0.1.0 = INTEGER: 1
SNMPv2-SMI::experimental.53.9.0.2.1.2.9.47.98.105.110.47.101.99.104.111 = STRING: "hello"

我的持久值在哪里?我可能不了解pass_persist是如何工作的


Tags: thestringisvaluetypeetcpassinteger

热门问题