I need advice on how to generate snmp traps within a compiled process.

Architecture constrains prevent me from just forking/shelling out to the snmptrap executable.

Ideally, I would like functions to build a trap and send it.

 

I examined the snmptrap.c source code with the plan to extract the pertinent parts of snmp trap generation

from the argument parsing.  This plan was complicated by the differences between v1 and v3 traps.  I have

separated (most) of the argument parsing logic from the trap generation logic.  I have used more of

snmptrap.c to cobble together a unit test driver to test this trap generation.

 

I am not very happy with how the resulting snmp trap generation function gets its arguments, nor how the

arguments (dest port, source host, OID, etc) are provided to this function.

 

Has anyone done anything similar?

Can anyone offer any insight or suggestions?

Have I missed something in net-snmp that offers this api?

Have I missed a simpler way to do this?

 

My system:

Net-Snmp 5.2.1

Redhat Linix Enterprise 3

Custom software with embedded MIB support using the table helper handlers and agentx.

 

Reply via email to