To be completely honest, that script is something like 15 years old, and I don’t think it’s been updated in that time. It’s mostly still there to just provide an example of how to handle snmpd traps, and a case could be made that it doesn’t belong in the docs at this point anyway.

I would suggest reading the snmpd docs on writing handler scripts.

Quentin

On Aug 14, 2019, at 8:09 AM, Simon Jones <batmanustc@gmail.com> wrote:

Hi all,

I'm following this to handle snmp trap: http://docs.frrouting.org/en/latest/snmp.html

this is /etc/snmp/snmptrapd.conf:
traphandle .3.6.1.2.1.15 /etc/snmp/snmptrap_handle.sh 

this is snmptrap_handle.sh:
echo "test" > temp.txt

and snmptrapd got SNMP trap like this:
root@NX-ZWYC-M1F202-A16-HW6865-A-INT-212:/# snmptrapd -f -Lo
NET-SNMP version 5.7.3
2019-08-14 11:53:50 172.18.8.212(via UDP: [127.0.0.1]:34916->[127.0.0.1]:162) TRAP, SNMP v1, community public
iso.3.6.1.2.1.15 Enterprise Specific Trap (2) Uptime: 2:11:33.09
iso.3.6.1.2.1.15.3.1.14.192.168.10.9 = Hex-STRING: 06 02 iso.3.6.1.2.1.15.3.1.2.192.168.10.9 = INTEGER: 6
2019-08-14 11:54:04 172.18.8.212(via UDP: [127.0.0.1]:34916->[127.0.0.1]:162) TRAP, SNMP v1, community public
iso.3.6.1.2.1.15 Enterprise Specific Trap (1) Uptime: 2:11:47.10
iso.3.6.1.2.1.15.3.1.14.192.168.10.9 = Hex-STRING: 06 02 iso.3.6.1.2.1.15.3.1.2.192.168.10.9 = INTEGER: 6
2019-08-14 11:57:39 172.18.8.212(via UDP: [127.0.0.1]:34916->[127.0.0.1]:162) TRAP, SNMP v1, community public
iso.3.6.1.2.1.15 Enterprise Specific Trap (2) Uptime: 2:15:22.90
iso.3.6.1.2.1.15.3.1.14.192.168.10.9 = Hex-STRING: 06 02 iso.3.6.1.2.1.15.3.1.2.192.168.10.9 = INTEGER: 6 

But  snmptrap_handle.sh does not work, as there is no temp.txt.

So why ?

BTW, this is also not work
/etc/snmp/snmptrapd.conf:
traphandle .1.3.6.1.4.1.3317.1.2.2 /etc/snmp/snmptrap_handle.sh 

----
Simon Jones
_______________________________________________
frog mailing list
frog@lists.frrouting.org
https://lists.frrouting.org/listinfo/frog