You can use commands to enable a switch to generate traps. If a trap is disabled, the switch does not generate the trap or send the trap to the NMS.
By default, some trap modules are enabled, while some are disabled. You can run the display snmp-agent trap all command to check the status of all trap modules. An example is as follows:
<HUAWEI> display snmp-agent trap all ------------------------------------------------------------------------------ Feature name: INFO Trap number : 2 ------------------------------------------------------------------------------ Trap name Default switch status Current switch status hwICLogFileAging on on hwICLogBufferLose on on ------------------------------------------------------------------------------ ---- More ----
Item |
Description |
---|---|
Feature name |
Name of a feature that generates traps. |
Trap number |
Number of traps generated by the feature. |
Trap name |
Name of a trap. |
Default switch status |
Default status of the trap:
|
Current switch status |
Current status of the trap:
The status of a trap can be configured using the snmp-agent trap enable feature-name command. |
To disable a trap or the trap function of a module, perform the following operations:
ENTITYTRAP_1.3.6.1.4.1.2011.5.25.219.2.4.5 hwOpticalInvalid 136xxx
These traps include the following keywords:
Parameter |
Description |
---|---|
feature-name |
Specifies the name of a feature that generates traps. |
trap-name |
Specifies the name of a trap. |
The following command is an example for masking traps related to optical modules:
undo snmp-agent trap enable feature-name ENTITYTRAP trap-name hwOpticalInvalid
In this scenario, the switch can still generate traps locally. In addition, the switch filters traps and sends only traps meeting specific rules to the NMS.
On the live network, customers sometimes need to send specific traps to specified hosts. For example, a customer deploys a dedicated NMS to monitor the link status (Up or Down) of network devices and does not want to receive other traps. To meet this requirement, you can run the snmp-agent notify-filter-profile command on the switch to configure a trap filter profile. This type of requirements generally involves two scenarios:
Configuration example for scenario 1: The customer wants to report link Up and Down traps to the NMS that uses IP address 10.8.8.8 and does not want to report other traps to the NMS.
OID |
Object Name |
Bound Variable |
Description |
Implemented Specifications |
---|---|---|---|---|
1.3.6.1.6.3.1.1.5.4 |
linkUp |
|
A linkUp trap indicates that the SNMP entity, acting as an agent, has detected that one of the communication links in the ifOperStatus object has changed from Down to another state (not notPresent). The new state is indicated by the value of ifOperStatus. |
This object is implemented as defined in the corresponding MIB file. |
OID |
Object Name |
Bound Variable |
Description |
Implemented Specifications |
---|---|---|---|---|
1.3.6.1.6.3.1.1.5.3 |
linkDown |
|
A linkDown trap indicates that the SNMP entity, acting as an agent, has detected that one of the communication links in the ifOperStatus object has changed to Down from another state (not notPresent). The original state is indicated by the value of ifOperStatus. |
This object is implemented as defined in the corresponding MIB file. |
snmp-agent notify-filter-profile included profile_a linkUp snmp-agent notify-filter-profile included profile_a linkDown
snmp-agent notify-filter-profile included profile_a ifIndex snmp-agent notify-filter-profile included profile_a ifDesc snmp-agent notify-filter-profile included profile_a ifAdminStatus snmp-agent notify-filter-profile included profile_a ifOperStatus
snmp-agent notify-filter-profile included profile_a sysUpTime snmp-agent notify-filter-profile included profile_a snmpTrapOID
snmp-agent target-host trap address udp-domain 10.8.8.8 params securityname cipher @%@%m%eiQi2Kz+-/Z:!gz24-a4IY@%@% v2c notify-filter-profile profile_a
Configuration example for scenario 2: The customer wants to report traps except linkUp and linkDown to the NMS.
In this scenario, pay attention to the following points:
The detailed configuration is as follows:
snmp-agent notify-filter-profile exclude profile_a linkUp snmp-agent notify-filter-profile exclude profile_a linkDown snmp-agent notify-filter-profile include profile_a iso
snmp-agent target-host trap address udp-domain 8.8.8.8 params securityname cipher @%@%m%eiQi2Kz+-/Z:!gz24-a4IY@%@% v2c notify-filter-profile profile_a