SNMP pass_persist似乎未执行



虽然调用pass_persist脚本SNMP时MIB的问题END接近我想要的,但答案很清楚,不完全是我的问题(我认为(。

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)

我的权限是+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被调用如果我把snmpd.conf末尾的extend .1.3.6.1.3.53.9.0 /bin/echo hello(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

最新更新