I am desperately looking for a way to create SNMP traps from PHP. I know that the built-in methods use snmpget, but I could not figure out how to send SNMP traps.
Does anyone know a code snippet / code for it? A search on the Internet did not bring up anything other than using exec to call cli tools, for which there is definitely no choice for me.
I suspect it would be necessary to use socket_create and related functions to manually create a UDP packet ...
, / php. SNMP . , () - , net-snmp.
snmptrap -v 1 -c public manager enterprises.spider test-hub 3 0 '' interfaces.iftable.ifentry.ifindex.1 i 1
linkUp , 1 ( manpage). php net-snmp , exec, shell_exec proc_open.
Obvisouly, , UDP, BER SNMP- , , :
SNMP. , SNMP udp. . http://code.google.com/p/php-snmp/, , .
, , , http://www.activexperts.com/network-component/howto/snmpts/php/
, , Google , - . , net-snmp - . , - , , net-snmp, apt-get ( php-snmp) Linux, , Windows . , PHP 5.3.3, PHP SNMP, exec, shell_exec proc_open. PHP. . http://php.net/manual/en/book.snmp.php
For those looking for such a library these days (in 2019), I found https://github.com/FreeDSx/SNMP, which supports sending SNMPv1 and SNMPv2 traps (including information requests).