【问题标题】:SNMP pass_persist does not seem to executeSNMP pass_persist 似乎没有执行
【发布时间】:2020-09-07 19:21:25
【问题描述】:

虽然END of MIB when calling pass_persist script SNMP 的问题与我正在寻找的问题很接近,但答案很明确,而不是我的问题(我认为)。

pass_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_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 的工作原理?

【问题讨论】:

    标签: python raspberry-pi snmp


    【解决方案1】:

    在安装 pass_persist 模块时,我需要使用 sudo。 sudo pip install snmp_passpersist

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多