phpsnmpsnmp-trap

Generate SNMP traps with PHP


I'm desperately searching for a way to generate SNMP traps from PHP. I know the build in methods to use snmpget but I was not able to figure out how to send SNMP traps.

Does anybody know a class / code snippet for it? Searching the web did not bring up anything other than using exec to call cli tools which is definately no option for me.

I suspect that it would be neccessary to use socket_create and corresponding functionality to generate the UDP package manually...


Solution

  • For anybody searching for such a library these days (in 2019), I found https://github.com/FreeDSx/SNMP which supports sending SNMPv1 and SNMPv2 traps (including inform requests).