Chapter 4: Testing Alerts Offline (snmp3 trap + syslog)
Send encrypted SNMPv3 authPriv traps and Syslog events to Zabbix, PRTG, or Splunk straight from numeric OIDs.
Prove your NMS wakes up the on-call rotation when uplink Gi1/0/24 dies — without actually taking down Building 2.
What You'll Pull Off Here
- Emit RFC 5424
syslogalerts withfacility,severity,hostname,app, andmsg. - Craft MIB-free
snmp2 trapand encryptedsnmp3 trap(sha256+aes) packets on UDP 162. - Chain repeatable numeric OID
varbindpairs (oidval,string,int,timeticks).
Lab 4: Escalate Gi1/0/1 to Critical Uplink Gi1/0/24
Bump the syslog alert from severity 4 to critical severity 2 mentioning "Gi1/0/24", and update the snmp3 trap interface string from "Gi1/0/1" to "Gi1/0/24".
- 1.On the
syslogline, changeseverity 4toseverity 2and mentionGi1/0/24insidemsg "...". - 2.On the
snmp3 trapline, changestring "Gi1/0/1"tostring "Gi1/0/24". - 3.Hit Check Exercise to verify both alerts compile cleanly.
1. SNMPv3 Crypto Without MIB-Path Despair
Anyone who has ever fought snmptrap -v 3 -e 0x8000... while Net-SNMP screams about missing vendor MIB files knows true spiritual pain.
FrameAssembly encodes ASN.1 BER and full RFC 3414/7860 SHA-256 + AES-128 USM encryption straight from numeric OIDs. On snmp2 and snmp3 traps, linkDown is just a standard varbind pairing 1.3.6.1.6.3.1.1.4.1.0 (snmpTrapOID.0) with oidval 1.3.6.1.6.3.1.1.5.3, followed by whatever interface varbinds you want.
- Text varbinds spell out
string "..."(neverstr "..."). snmp3engineidtakes an even-length hex string like"80001f888011223344".trap,inform, andreportauto-target UDP162;get,getnext,getbulk, andsetauto-target UDP161.
Word-by-Word Syntax BreakdownAnatomy of an SNMP trap carrying two numeric varbinds:
access_sw -> nms_srv snmp2 trap community "noc-alerts" sysuptime 125000 varbind 1.3.6.1.6.3.1.1.4.1.0 oidval 1.3.6.1.6.3.1.1.5.3 varbind 1.3.6.1.2.1.2.2.1.2.24 string "Gi1/0/24"snmp2 trapPDU TypeSNMPv2c Trapv2-PDU routed automatically to UDP 162community "noc-alerts"AuthCommunity string (or user + auth + priv on snmp3)varbind 1.3.6.1.6.3.1.1.4.1.0 oidval 1.3.6.1.6.3.1.1.5.3Trap OIDSets snmpTrapOID.0 to standard linkDownvarbind 1.3.6.1.2.1.2.2.1.2.24 string "Gi1/0/24"Payload VarbindSets ifDescr.24 to "Gi1/0/24"Quick Formatting Reference (2 rules)
| Item | Valid .frasm | Avoid |
|---|---|---|
| Varbind string keyword | varbind 1.3.6.1.2.1.1.5.0 string "sw-floor2" | varbind 1.3.6.1.2.1.1.5.0 str "sw-floor2" |
| Setting Trap OID | snmp2 trap varbind 1.3.6.1.6.3.1.1.4.1.0 oidval 1.3.6.1.6.3.1.1.5.3 | snmp2 trap trapoid 1.3.6.1.6.3.1.1.5.3 |
syslog || snmp