SNMP Notification (SNMPv2 Trap)

Hi,can sombody tell me, how can I generate SNMPv2 Trap (Notification) in the NS7520 (Net+OS 6.0). I can only send SNMPv1 Traps. Is there any documemtation abaut the SNMPv2 Trap (Notification)? Paul

As per Netsilicon’s Documentation: Notes Trap messages are sent from the SNMP agent running on the NetSilicon board to an SNMP management station. A trap message indicates that an event occurred on the board that the management station should know about. The SNMP agent supports only MIB-II, which has no mechanism for registering trap addresses or generating traps; the SNMP agent itself does not generate traps. Therefore, an API is provided. The API passes messages to the SNMP agent, which periodically checks for these messages and transmits them. Trap messages are generated asynchronously by the NetSilicon board and sent to a management station’s UDP port 162. The API provided allows you to send a trap message to the SNMP agent, which in turn sends it out to the specified IP address. A trap PDU consists of a trap header followed by any number of interesting variables. The trap header consists of an enterprise OID, agent address, trap type, status code, and time stamp. Each variable consists of a variable name and value.

The connection is with struct variable_t; This struct points to the trap structure that you define/declare. I also holds the byte count, OID, etc. The SNMPSendTrap function then takes the struct variable_t variable once filled in, and transmits it.

Thanks for your answer, but it doesn’t help me. I can send Traps (SNMPv1 Trap-PDU) from the agent to the managed station. This is no Problem. I want to send Traps with the SNMPv2c PDU from the agent to the managed station. Is it possible or not?

As per the help file: Category: SNMP API These constants identify trap types. Members Name Description TRAP_TYPE SNMP version 1 trap NOTIFICATION_TYPE SNMP version 2 notification See also snmpAgentTrapType Version information Available since version 5.0 Example: snmpAgentTrapType tdiTrapOnBatteryTrap = { “TrapOnBattery”, /* name of this trap / “”, / OID for this trap / -1, / trap number / TRAP_TYPE, / trap is SMI-1 trap event / 3, / number of variables associated with this trap / tdiTrapOnBatteryVars / list of variables to send with this trap */ }; Where you see TRAP_TYPE, you can change that to NOTIFICATION_TYPE. However, I don’t know if SNMPSendTrap, the function that sends the traps, actually supports traps of type NOTIFICATION_TYPE.

I couldn’t find a connection between the snmpAgentTrapVarType variable generated by MIBMAN when you add trap definitions to MIB file and the SNMPSendTrap function. It looks like the first is useless. Adrian

I understand how SNMPSendTrap function works and I use it exactly as said: I fill a variable_t structure and I sent it. What I said was that the structure snmpAgentTrapVarType is useless. It has different members, except the oid, and these members are not used in sending traps. Adrian