csnmpnet-snmpsnmpdsnmptrapd

How to write a code sending user defined traps by using Net-SNMP API


Can we write the code for sending user defined traps rather than those mentioned in snmpd using Net-SNMP API like below to send traps netsnmp_send_traps(), send_v2trap(), send_v3trap()?

I am not planning to write any MIB module. So I don't expect that my trap should be going through snmpd (Agent Daemon).

The idea I want to implement is that sending trap from external code to snmptrapd which will receive traps and forward it to configured trap receiver to get more familiar with Net-SNMP library.


Solution

  • There is no Net-SNMP API provided. We can just fork-exec Net-SNMP command to send trap.