问题描述
虽然问题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
返回PONG
,DUMP
返回
{'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,并且看到了步行
如果我放
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的工作方式,我可能不了解什么?
解决方法
在安装pass_persist模块时,我需要使用sudo。
sudo pip install snmp_passpersist