< Home

(Optional) Configuring the Trap Function

Context

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.

Procedure

  1. Run system-view

    The system view is displayed.

  2. Enable the trap function.

    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:

    1. Run the interface interface-type interface-number command to enter the interface view.

    2. Run the undo enable snmp trap updown command to disable the interface status trap function.

    3. Run the quit command to return to the system view.

  3. Run snmp-agent trap type { base-trap | entity-trap }

    The trap format is set.

    By default, the device sends BASETRAP traps.

  4. Run snmp-agent notify-filter-profile { excluded | included } profile-name oid-tree

    A trap filtering rule is created or updated.

    By default, traps are not filtered.

  5. Run snmp-agent trap source interface-type interface-number

    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.

  6. Run snmp-agent trap source-port port-number

    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.

  7. Run snmp-agent trap queue-size size

    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.

  8. Run snmp-agent trap life seconds

    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.

  9. Run snmp-agent trap start-trap resend disable

    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.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >