SNMPTRAP(1)
π SNMPTRAP β the Net-SNMP girlies' guide π
okay so bestie, this is the snmptrap(1) page from the Net-SNMP manual, and also snmpinform β they're like twins, one of them just texts back. π
β¨ NAME β¨
snmptrap, snmpinform β sends an SNMP notification to a manager π«Ά
β¨ SYNOPSIS β¨
snmptrap -v 1 [COMMON OPTIONS] AGENT enterprise-oid agent generic-trap
specific-trap uptime [OID TYPE VALUE]...
snmptrap -v [2c|3] [COMMON OPTIONS] [-Ci] AGENT uptime trap-oid [OID
TYPE VALUE]...
snmpinform -v [2c|3] [COMMON OPTIONS] AGENT uptime trap-oid [OID
TYPE VALUE]...
β¨ DESCRIPTION β¨
so snmptrap is an SNMP application that uses the SNMP TRAP operation to send info to a network manager. like, it's the one sliding into the manager's DMs unprompted. π
you can hand it one or more object identifiers (OIDs) as arguments on the command line, no cap. and every single object identifier needs a type and a value riding along with it β they're a package deal, bestie. each variable name gets written in the format that's spelled out in variables(5).
when you invoke it as snmpinform, or when you add -Ci to the command line flags of snmptrap, it sends an INFORM-PDU instead β and that one expects a response from the trap receiver, retransmitting if required. it's giving "did you get my message?? π₯Ί did you??" otherwise it sends a TRAP-PDU or a TRAP2-PDU, which is more of a "no reply needed, just vibing" situation.
if any of the required version 1 parameters β enterprise-oid, agent, and uptime β are specified as empty, it defaults to:
1.3.6.1.4.1.3.1.1(that'senterprises.cmu.1.1, iconic)hostnamehost-uptime
respectively. slay. β¨
π the TYPE character π
the TYPE is a single character, and it's gotta be one of these:
i INTEGER
u UNSIGNED
c COUNTER32
s STRING
x HEX STRING
d DECIMAL STRING
n NULLOBJ
o OBJID
t TIMETICKS
a IPADDRESS
b BITS
and these are handled in the exact same way as the snmpset command. iykyk. π
πΈ about the AGENT argument πΈ
the AGENT argument is only embedded in SNMP TRAP PDUs but not in SNMP INFORM PDUs. so if you were wondering why it ghosted your inform, that's why. π
if AGENT is not an empty string, it must be an IPv4 address. this limitation comes from RFC 1157, in which the agent address field is defined as follows:
agent-addr NetworkAddress, -- address of object generating trap
and from RFC 1155:
NetworkAddress ::=
CHOICE {
internet IpAddress
}
[ ... ]
IpAddress ::=
[APPLICATION 0] -- in network-byte order
IMPLICIT OCTET STRING (SIZE (4))
π¦ an example, because examples ate π¦
here's an example of how to use snmptrap:
snmptrap -v 1 -c public manager enterprises.spider test-hub 3 0 ''
interfaces.iftable.ifentry.ifindex.1 i 1
this will send a generic linkUp trap to manager, for interface 1. periodt. π₯
β¨ OPTIONS β¨
snmptrap takes the common options described in the snmpcmd(1) manual page, plus the -Ci option we already talked about up above. π
β οΈ note that snmptrap REQUIRES an argument specifying the agent to query, as described there. it's not optional, bestie. it will not let you skip that step. π
β¨ SEE ALSO β¨
and that's the whole page, angel!! go forth and send your traps π
this was Net-SNMP version V5.9.5.2, dated 19 Jun 2003 β yeah she's an elder icon but she still serves πππ
π¦ 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-utils 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: snmp 5.9.5.2+dfsg-2.1ubuntu5
- Copyright 1988, 1989 by Carnegie Mellon University
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms