snmptt使用snmptthandler与snmptthandler-embedded的不同

发布时间 2023-05-24 23:27:12作者: 小阿里

由于咱不知的原因,在同样的snmptrap的配置下,两种方法得到的trap信息不同,所以不同的解析方法要使用不同的snmptrap配置:

1、当使用traphandle default /usr/sbin/snmptthandler时,可以不用关心snmptrap的输出格式,似乎snmptt自己会解析原始的数据似的,这时的snmptrapd的配置如下 :

/usr/sbin/snmptrapd -Lf /var/log/snmptrapd.log -f  -p /run/snmptrapd.pid

2、当使用perl do "/usr/lib/snmptt/snmptthandler-embedded"来解析时,按照官方说如果使用net-snmp perl扩展可以不用-On,但是我不使用时,在snmptt的event中无法匹配到trap name,也就没有格式化信息的说法了,而且当出现 hex-string数据时,也会因为这个字段无法解析hex-string成相应的数据,所以这时的snmptrapd的配置如下 :

/usr/sbin/snmptrapd -Lf /var/log/snmptrapd.log -OQn -f -p /run/snmptrapd.pid