---
name: "netsnmp_trap_api"
section: "3"
platform: "linux"
package: "net-snmp"
version: "5.9.5.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/netsnmp_trap_api"
---

# netsnmp\_trap\_api(3)

send TRAPs or INFORMs from a Net-SNMP MIB module

## NAME

send\_easy\_trap, send\_trap\_vars, send\_v2trap - send TRAPs or INFORMs from a Net-SNMP MIB module

## SYNOPSIS

**#include \<net-snmp/agent/agent\_trap.h\>**

**void send\_easy\_trap(int** *trap***, int** *specific***);**

**void send\_trap\_vars(int** *trap***, int** *specific***, struct variable\_list \****vars***);**

**void send\_v2trap(struct variable\_list \****vars***);**

## DESCRIPTION

These three routines may be used to send traps from a MIB module within the Net-SNMP agent (including an AgentX subagent).

**send\_easy\_trap()** sends an SNMPv1 trap (or the SNMPv2 equivalent) to the list of configured trap destinations (or "sinks"), using the provided values for the generic trap type, and specific trap value.

**send\_trap\_vars()** is similar, but appends the supplied list of variable bindings to the traps that are sent.

**send\_v2trap()** uses the supplied list of variable bindings to form an SNMPv2 trap, which is sent to SNMPv2-capable sinks on the configured list.  An equivalent INFORM is sent to the configuredq list of inform sinks. Sinks that can only handle SNMPv1 traps are skipped.

The various "send\_trap()" calls allow you to specify traps in different formats.  And the various "trapsink" directives allow you to specify destinations to receive different formats. But \*all\* traps are sent to \*all\* destinations, regardless of how they were specified.

```
I.e. it's
                                         ___  trapsink
                                        /
    send_easy_trap ___  [  Trap      ] ____  trap2sink
                    ___  [ Generator  ]
    send_v2trap    /     [            ] ----- informsink
                                        ____
                                              trapsess
*Not*
     send_easy_trap  ------------------->  trapsink
     send_v2trap     ------------------->  trap2sink
     ????            ------------------->  informsink
     ????            ------------------->  trapsess
```

## WARNINGS

These routines are used to send the traps immediately they are called. Invoking them at the appropriate time is left to the MIB module programmer.

## SEE ALSO

[**snmpd.conf**(5)](/snmpd.conf/5.md), [**snmptrapd**(8)](/snmptrapd/8.md)
