We always try to clarify the differences between terminologies that otherwise seem to be similar. In our previous posts, we provided clarification on difference between trap and alarm & difference between trap and inform. As the title suggests, this post talks about difference between SNMP trap and SNMP notification.
If you refer to the SNMP PDU Formats for SNMPv1 and SNMPv2 here, you will realize that SNMPv1 has two different pdu formats, one for trap and another for all remaining snmp operations (get, set etc.). However, in SNMPv2 the pdu format for trap and all other snmp operations (except getbulk) is identical. To standardize the PDU Format of SNMPv1 traps, concept of Notification was introduced in SNMPv2 and same was carried forward to SNMPv3.
Thus, asynchronous event sent to manager by agent is known as Trap in SNMPv1 and Notification in SNMPv2 and SNMPv3.
With respect to the MIB definitions and PDU formats, below are the significant difference between Trap and Notification:
- The macro used for setting trap in SNMPv1 is TRAP-TYPE MACRO and the macro used for setting notifications in SNMPv2/v3 is NOTIFICATION-TYPE MACRO.
- Trap PDU contains agent address whereas Notification PDU contains error status and error index.
- TRAP PDU contains information about generic and specific traps whereas Notification PDU contains Trap OID.
- TRAP is asynchronous. Notification is asynchronous too but SNMV2/SNMPv3 supports confirmed notification known as Inform.
With reference to RFC2576, if a MIB module is changed to conform to the SMIv2, then each occurrence of the TRAP-TYPE macro MUST be changed to a corresponding invocation of the NOTIFICATION-TYPE macro. Have a look at RFC2576 here for translation rules and further clarification on traps and notifications.
Hope you find the information presented here useful. Feel free to leave your inputs in the comments section below.