NETSNMP_TRAP_API(3)
β¨ NAME β¨
okay so bestie, this is netsnmp_trap_api(3) from the Net-SNMP crew π
and it's the whole vibe for sending TRAPs and INFORMs out of a Net-SNMP MIB module π
Meet the trio: send_easy_trap, send_trap_vars, and send_v2trap β they send TRAPs or INFORMs from a Net-SNMP MIB module. no cap. π₯
πΈ 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 π¦
So these three routines are your little group chat of trap-senders, and you can use them to send traps from a MIB module that lives inside the Net-SNMP agent (and yes, that includes an AgentX subagent, we see you π«Ά).
send_easy_trap()β sends an SNMPv1 trap (or the SNMPv2 equivalent, slay) to the list of configured trap destinations (aka "sinks"), using the values you handed it for the generic trap type and the specific trap value. lowkey the simplest one.send_trap_vars()β basically the same energy, but it appends the list of variable bindings you supply onto the traps that get sent. extra data, extra cute β¨send_v2trap()β takes your supplied list of variable bindings and uses them to form an SNMPv2 trap, which gets sent to the SNMPv2-capable sinks on the configured list. An equivalent INFORM goes to the configured list of inform sinks. Sinks that can only handle SNMPv1 traps get skipped entirely, sorry not sorry π
the way the trap formats actually work π§
The various "send_trap()" calls let you specify traps in different formats. And the various "trapsink" directives let you specify destinations to receive different formats. But β and this is the plot twist β *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* this, bestie:
send_easy_trap -------------------> trapsink
send_v2trap -------------------> trap2sink
???? -------------------> informsink
???? -------------------> trapsess
β οΈ WARNINGS β οΈ
These routines are used to send the traps immediately they are called. Like, zero chill, no queue, no waiting. π¨
Invoking them at the appropriate time is left to the MIB module programmer β that's you, main character π. it's giving "your problem now" fr fr.
π SEE ALSO π
okay that's the whole page babes π this was Net-SNMP manual page NETSNMP_TRAP_API(3), version V5.9.5.2, dated 13 Aug 2010. iconic. historic. ate. periodt π
β¨π
π¦ where this page comes from
- alpine 3.23: net-snmp-doc 5.9.5.2-r0 Β· Net-SNMP
- alpine 3.24: net-snmp-doc 5.9.5.2-r0 Β· Net-SNMP
- arch rolling: net-snmp 5.9.5.2-2 Β· BSD
- fedora 44: net-snmp-devel 1:5.9.5.2-4.fc44 Β· MIT-CMU AND BSD-3-Clause AND MIT
- fedora 44: net-snmp-devel 1:5.9.5.2-4.fc44 Β· MIT-CMU AND BSD-3-Clause AND MIT
- nixos 26.05: net-snmp 5.9.5.2
- nixpkgs unstable: net-snmp 5.9.5.2
- ubuntu stonking: libsnmp-dev 5.9.5.2+dfsg-2.1ubuntu5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms