You can enable the device to send traps of a specified type to the NMS, which facilitates fault location. You can also specify trap parameters to improve the reliability of trap transmission.
The system view is displayed.
Enable the trap function for a module:
To enable the trap function of all modules, run the snmp-agent trap enable command.
To enable the trap function of a specified module, run the snmp-agent trap enable feature-name feature-name [ trap-name trap-name ] command.
To restore the trap functions of all modules to the default status, run the undo snmp-agent trap enable or undo snmp-agent trap disable command.
To delete all trap functions in a batch, run the clear configuration snmp-agent trap enable command.
Enable the trap function for an interface:
Run the snmp-agent trap enable feature-name ifnet trap-name { linkdown | linkup } command to enable the interface status trap function globally.
By default, the trap function is disabled on all interfaces. When the linkdown and linkup parameters are configured for ifnet module, the device sends a trap to the NMS upon an interface status change. If the interface status frequently changes, the interface frequently sends traps to the NMS, subjecting the NMS to a heavy load. To combat this problem, disable the interface status trap function on the interface. The procedure is as follows:
The trap format is set.
By default, the device sends BASETRAP traps.
A trap filtering rule is created or updated.
By default, traps are not filtered.
The source interface for sending traps is specified.
By default, source interface of traps is not set. After the source interface is specified, the IP address of the source interface is used as the source IP address for sending traps. This helps the NMS identify the trap source. The source interface that sends traps must have an IP address; otherwise, the command will fail to take effect. To ensure device security, it is recommended that you set the source IP address to the local loopback address.
The source interface set on the switch must be consistent with that specified on the NMS. Otherwise, the NMS does not accept the traps sent from the switch.
The source port to send trap is set.
The source port needs to be fixed. Packets can be filtered by a firewall to improve network security.
The queue length of traps sent to the target host is set.
The default queue length of traps sent to the target host is 1000.
Set the queue length according to the number of generated traps. For example, if the switch frequently sends traps to the NMS, set a longer queue length to prevent traps from being lost.
The lifetime of traps is set.
The default lifetime of traps is 300 seconds.
Set the lifetime of each trap according to the number of generated traps. For example, if the switch frequently sends traps to the NMS, set a longer lifetime to prevent traps from being lost.
The function of resending cold-start and warm-start traps is disabled.
By default, the function of resending cold-start and warm-start traps is enabled.